Quickapiclient

Latest version: v0.5.0

Safety actively analyzes 682487 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

0.5.0

Introducing first class support for API client definitions

Each client definition can support multiple API endpoints and optionally share state (auth, session, etc).

Example:

python
from dataclasses import dataclass
import quickapi


An example type that will be part of the API response
dataclass
class Fact:
fact: str
length: int


What the API response should look like
dataclass
class ResponseBody:
current_page: int
data: list[Fact]


We define an API endpoint
class GetFactsApi(quickapi.BaseApi[ResponseBody]):
url = "/facts"
response_body = ResponseBody


And now our API client
class ExampleClient(quickapi.BaseClient):
base_url = "https://example.com"
get_facts = quickapi.ApiEndpoint(GetFactsApi)
Other endpoints would follow here:
submit_fact = quickapi.ApiEndpoint(SubmitFactApi)


And you can use it like this:

python
client = ExampleClient()
response = client.get_facts()

`response` is fully typed and conforms to our `ResponseBody` definition
assert isinstance(response.body, ResponseBody)
assert isinstance(response.body.data[0], Fact)

`reveal_type(response.body)` returns `Revealed type is 'ResponseBody'` too,
which means full typing and IDE support.


What's changed

* Improve API client definition and usage by martinn in https://github.com/martinn/quickapiclient/pull/17
* Ensure we support `kwargs` for API client endpoints by martinn in https://github.com/martinn/quickapiclient/pull/20
* Documentation improvements by martinn in https://github.com/martinn/quickapiclient/pull/19


**Full Changelog**: https://github.com/martinn/quickapiclient/compare/v0.0.15...v0.5.0

0.0.15

What's Changed
* feat: add msgspec support by aarcex3 in https://github.com/martinn/quickapiclient/pull/14
* Add Python 3.12 to test matrix by martinn in https://github.com/martinn/quickapiclient/pull/15

New Contributors
* aarcex3 made their first contribution in https://github.com/martinn/quickapiclient/pull/14

**Full Changelog**: https://github.com/martinn/quickapiclient/compare/v0.0.14...v0.0.15

0.0.14

What's Changed
* Add basic support for custom error handling by martinn in https://github.com/martinn/quickapiclient/pull/11 - now your HTTP errors can be fully typed too!


**Full Changelog**: https://github.com/martinn/quickapiclient/compare/v0.0.13...v0.0.14

0.0.13

What's Changed
* build(deps): Bump urllib3 from 2.2.1 to 2.2.2 in the pip group across 1 directory by dependabot in https://github.com/martinn/quickapiclient/pull/8
* build(deps): Bump certifi from 2024.2.2 to 2024.7.4 in the pip group across 1 directory by dependabot in https://github.com/martinn/quickapiclient/pull/9
* build(deps-dev): Bump setuptools from 69.5.1 to 70.0.0 in the pip group across 1 directory by dependabot in https://github.com/martinn/quickapiclient/pull/10


**Full Changelog**: https://github.com/martinn/quickapiclient/compare/v0.0.12...v0.0.13

0.0.12

What's Changed
* build(deps): Bump idna from 3.6 to 3.7 by dependabot in https://github.com/martinn/quickapiclient/pull/1
* Update mkdocs documentation dependency by martinn in https://github.com/martinn/quickapiclient/pull/6
* build(deps): Bump requests from 2.31.0 to 2.32.0 in the pip group across 1 directory by dependabot in https://github.com/martinn/quickapiclient/pull/7

**Full Changelog**: https://github.com/martinn/quickapiclient/compare/v0.0.11...v0.0.12

0.0.11

- Internal refactors (no visible or breaking changes)
- Documentation improvements

**Full Changelog**: https://github.com/martinn/quickapiclient/compare/v0.0.10...v0.0.11

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.