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
The Openlayer Python library provides convenient access to the Openlayer REST API from any Python 3.7+
6
6
application. The library includes type definitions for all request params and response fields,
@@ -16,7 +16,7 @@ The REST API documentation can be found [on openlayer.com](https://openlayer.com
16
16
17
17
```sh
18
18
# install from PyPI
19
-
pip install --pre openlayer_test
19
+
pip install --pre openlayer
20
20
```
21
21
22
22
## Usage
@@ -25,7 +25,7 @@ The full API of this library can be found in [api.md](api.md).
25
25
26
26
```python
27
27
import os
28
-
fromopenlayer_testimport Openlayer
28
+
fromopenlayerimport Openlayer
29
29
30
30
client = Openlayer(
31
31
# This is the default and can be omitted
@@ -66,7 +66,7 @@ Simply import `AsyncOpenlayer` instead of `Openlayer` and use `await` with each
66
66
```python
67
67
import os
68
68
import asyncio
69
-
fromopenlayer_testimport AsyncOpenlayer
69
+
fromopenlayerimport AsyncOpenlayer
70
70
71
71
client = AsyncOpenlayer(
72
72
# This is the default and can be omitted
@@ -113,16 +113,16 @@ Typed requests and responses provide autocomplete and documentation within your
113
113
114
114
## Handling errors
115
115
116
-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openlayer_test.APIConnectionError` is raised.
116
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openlayer.APIConnectionError` is raised.
117
117
118
118
When the API returns a non-success status code (that is, 4xx or 5xx
119
-
response), a subclass of `openlayer_test.APIStatusError` is raised, containing `status_code` and `response` properties.
119
+
response), a subclass of `openlayer.APIStatusError` is raised, containing `status_code` and `response` properties.
120
120
121
-
All errors inherit from `openlayer_test.APIError`.
121
+
All errors inherit from `openlayer.APIError`.
122
122
123
123
```python
124
-
importopenlayer_test
125
-
fromopenlayer_testimport Openlayer
124
+
importopenlayer
125
+
fromopenlayerimport Openlayer
126
126
127
127
client = Openlayer()
128
128
@@ -146,12 +146,12 @@ try:
146
146
}
147
147
],
148
148
)
149
-
exceptopenlayer_test.APIConnectionError as e:
149
+
exceptopenlayer.APIConnectionError as e:
150
150
print("The server could not be reached")
151
151
print(e.__cause__) # an underlying Exception, likely raised within httpx.
152
-
exceptopenlayer_test.RateLimitError as e:
152
+
exceptopenlayer.RateLimitError as e:
153
153
print("A 429 status code was received; we should back off a bit.")
154
-
exceptopenlayer_test.APIStatusError as e:
154
+
exceptopenlayer.APIStatusError as e:
155
155
print("Another non-200-range status code was received")
156
156
print(e.status_code)
157
157
print(e.response)
@@ -179,7 +179,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
179
179
You can use the `max_retries` option to configure or disable retry settings:
180
180
181
181
```python
182
-
fromopenlayer_testimport Openlayer
182
+
fromopenlayerimport Openlayer
183
183
184
184
# Configure the default for all requests:
185
185
client = Openlayer(
@@ -215,7 +215,7 @@ By default requests time out after 1 minute. You can configure this with a `time
215
215
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
216
216
217
217
```python
218
-
fromopenlayer_testimport Openlayer
218
+
fromopenlayerimport Openlayer
219
219
220
220
# Configure the default for all requests:
221
221
client = Openlayer(
@@ -283,7 +283,7 @@ if response.my_field is None:
283
283
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
@@ -309,9 +309,9 @@ data = response.parse() # get the object that `inference_pipelines.data.stream(
309
309
print(data.success)
310
310
```
311
311
312
-
These methods return an [`APIResponse`](https://github.com/openlayer-ai/openlayer-python/tree/main/src/openlayer_test/_response.py) object.
312
+
These methods return an [`APIResponse`](https://github.com/openlayer-ai/openlayer-python/tree/main/src/openlayer/_response.py) object.
313
313
314
-
The async client returns an [`AsyncAPIResponse`](https://github.com/openlayer-ai/openlayer-python/tree/main/src/openlayer_test/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
314
+
The async client returns an [`AsyncAPIResponse`](https://github.com/openlayer-ai/openlayer-python/tree/main/src/openlayer/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
315
315
316
316
#### `.with_streaming_response`
317
317
@@ -391,7 +391,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
"max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `openlayer_test.DEFAULT_MAX_RETRIES`"
364
+
"max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `openlayer.DEFAULT_MAX_RETRIES`"
0 commit comments