Skip to content

Repository files navigation

Introduction

If you've ever tried to make an API wrapper you probably know that the code written can only be used as sync or async, well, not anymore.

Features

  • Lightweight: Extremely lightweight and minimal
  • Easy to use: Implement features in no time with the
  • Async and blocking: Provides both async and blocking calls
  • Test without a server: Since the library internally uses httpx, it can be used to test itself using an ASGI or WSGI application.
  • DRY: Don't repeat yourself, helps avoid code duplication and write reusable code
  • Routing: An APIRouter class with simliar API to APIClient
  • Modular: Create reusable routers that can be added to any client, independant of each other

Example Usage

fromapiclientimportAPIClient, endpoint, PostclassCodeExecClient(APIClient):
base_url="https://pathtomysite.com/api/1.0"# Note the missing / suffix@endpointdefrun(self, language:str, code:str):
# Do any processing with the data here!# Also note the / prefix in the urlreturnPost("/execute", params={'lang':language, 'code':code})
# Using the API clientfromhttpximportClientclient=CodeExecClient(session=Client())
response=client.run("py", "print('hello world!')")

Documentation is under works

About

Create API wrappers/clients in minutes, enjoying both blocking and async interfaces from one codebase!

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages