1
- # my-test-api-client
1
+ # custom-e2e
2
2
A client library for accessing My Test API
3
3
4
4
## Usage
5
5
First, create a client:
6
6
7
7
``` python
8
- from my_test_api_client import Client
8
+ from custom_e2e import Client
9
9
10
10
client = Client(base_url = " https://api.example.com" )
11
11
```
12
12
13
13
If the endpoints you're going to hit require authentication, use ` AuthenticatedClient ` instead:
14
14
15
15
``` python
16
- from my_test_api_client import AuthenticatedClient
16
+ from custom_e2e import AuthenticatedClient
17
17
18
18
client = AuthenticatedClient(base_url = " https://api.example.com" , token = " SuperSecretToken" )
19
19
```
20
20
21
21
Now call your endpoint and use your models:
22
22
23
23
``` python
24
- from my_test_api_client .models import MyDataModel
25
- from my_test_api_client .api.my_tag import get_my_data_model
24
+ from custom_e2e .models import MyDataModel
25
+ from custom_e2e .api.my_tag import get_my_data_model
26
26
27
27
my_data: MyDataModel = get_my_data_model(client = client)
28
28
```
29
29
30
30
Or do the same thing with an async version:
31
31
32
32
``` python
33
- from my_test_api_client .models import MyDataModel
34
- from my_test_api_client .async_api.my_tag import get_my_data_model
33
+ from custom_e2e .models import MyDataModel
34
+ from custom_e2e .async_api.my_tag import get_my_data_model
35
35
36
36
my_data: MyDataModel = await get_my_data_model(client = client)
37
37
```
@@ -40,9 +40,9 @@ Things to know:
40
40
1 . Every path/method combo becomes a Python function with type annotations.
41
41
1 . All path/query params, and bodies become method arguments.
42
42
1 . If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
43
- 1 . Any endpoint which did not have a tag will be in ` my_test_api_client .api.default`
43
+ 1 . Any endpoint which did not have a tag will be in ` custom_e2e .api.default`
44
44
1 . If the API returns a response code that was not declared in the OpenAPI document, a
45
- ` my_test_api_client .api.errors.ApiResponseError` wil be raised
45
+ ` custom_e2e .api.errors.ApiResponseError` wil be raised
46
46
with the ` response ` attribute set to the ` httpx.Response ` that was received.
47
47
48
48
0 commit comments