You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***package:** support direct resource imports ([5a8f2bd](https://github.com/riza-io/riza-api-python/commit/5a8f2bd588ed788643b59c1f64bf88af21f8774e))
21
+
***tests:** fix: tests which call HTTP endpoints directly with the example parameters ([4ebdf17](https://github.com/riza-io/riza-api-python/commit/4ebdf17f9eba4d440261e307da12be148e4ab8c8))
22
+
23
+
24
+
### Chores
25
+
26
+
***ci:** enable for pull requests ([ce5b546](https://github.com/riza-io/riza-api-python/commit/ce5b546ced715900bff3f6d5a965ff482c20d46c))
***internal:** avoid errors for isinstance checks on proxies ([df06fdf](https://github.com/riza-io/riza-api-python/commit/df06fdf1fd3534a47862a98e9df3868dc8813dd9))
***tests:** add tests for httpx client instantiation & proxies ([81ec20b](https://github.com/riza-io/riza-api-python/commit/81ec20b4c46eacb48f8f715aa195d621e2e663de))
36
+
***tests:** run tests in parallel ([9c06af9](https://github.com/riza-io/riza-api-python/commit/9c06af9e919b3037638e51813d6172d6f5e9318e))
37
+
***tests:** skip some failing tests on the latest python versions ([afe509f](https://github.com/riza-io/riza-api-python/commit/afe509f0aad8d8e1f75a4a55af506f7ec178005a))
The Riza Python library provides convenient access to the Riza REST API from any Python 3.8+
6
6
application. The library includes type definitions for all request params and response fields,
@@ -35,7 +35,7 @@ response = client.command.exec(
35
35
code="print('Hello, World!')",
36
36
language="python",
37
37
)
38
-
print(response.duration)
38
+
print(response.id)
39
39
```
40
40
41
41
While you can provide an `api_key` keyword argument,
@@ -62,14 +62,49 @@ async def main() -> None:
62
62
code="print('Hello, World!')",
63
63
language="python",
64
64
)
65
-
print(response.duration)
65
+
print(response.id)
66
66
67
67
68
68
asyncio.run(main())
69
69
```
70
70
71
71
Functionality between the synchronous and asynchronous clients is otherwise identical.
72
72
73
+
### With aiohttp
74
+
75
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
76
+
77
+
You can enable this by installing `aiohttp`:
78
+
79
+
```sh
80
+
# install from PyPI
81
+
pip install rizaio[aiohttp]
82
+
```
83
+
84
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
85
+
86
+
```python
87
+
import os
88
+
import asyncio
89
+
from rizaio import DefaultAioHttpClient
90
+
from rizaio import AsyncRiza
91
+
92
+
93
+
asyncdefmain() -> None:
94
+
asyncwith AsyncRiza(
95
+
api_key=os.environ.get("RIZA_API_KEY"), # This is the default and can be omitted
96
+
http_client=DefaultAioHttpClient(),
97
+
) as client:
98
+
response =await client.command.exec(
99
+
code="print('Hello, World!')",
100
+
language="python",
101
+
)
102
+
print(response.id)
103
+
104
+
105
+
asyncio.run(main())
106
+
```
107
+
73
108
## Using types
74
109
75
110
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
0 commit comments