File tree Expand file tree Collapse file tree 4 files changed +42
-3
lines changed
end_to_end_tests/golden-record/my_test_api_client
integration-tests/integration_tests
openapi_python_client/templates Expand file tree Collapse file tree 4 files changed +42
-3
lines changed Original file line number Diff line number Diff line change 6
6
7
7
@attr .s (auto_attribs = True )
8
8
class Client :
9
- """A class for keeping track of data related to the API"""
9
+ """A class for keeping track of data related to the API
10
+
11
+ Attributes:
12
+ base_url: The base URL for the API, all requests are made to a relative path to this URL
13
+ cookies: A dictionary of cookies to be sent with every request
14
+ headers: A dictionary of headers to be sent with every request
15
+ timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if
16
+ this is exceeded.
17
+ verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production,
18
+ but can be set to False for testing purposes.
19
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatusException if the API returns a
20
+ status code that was not documented in the source OpenAPI document.
21
+ """
10
22
11
23
base_url : str
12
24
cookies : Dict [str , str ] = attr .ib (factory = dict , kw_only = True )
Original file line number Diff line number Diff line change 6
6
7
7
@attr .s (auto_attribs = True )
8
8
class Client :
9
- """A class for keeping track of data related to the API"""
9
+ """A class for keeping track of data related to the API
10
+
11
+ Attributes:
12
+ base_url: The base URL for the API, all requests are made to a relative path to this URL
13
+ cookies: A dictionary of cookies to be sent with every request
14
+ headers: A dictionary of headers to be sent with every request
15
+ timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if
16
+ this is exceeded.
17
+ verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production,
18
+ but can be set to False for testing purposes.
19
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatusException if the API returns a
20
+ status code that was not documented in the source OpenAPI document.
21
+ """
10
22
11
23
base_url : str
12
24
cookies : Dict [str , str ] = attr .ib (factory = dict , kw_only = True )
Original file line number Diff line number Diff line change @@ -61,6 +61,9 @@ client = AuthenticatedClient(
61
61
)
62
62
```
63
63
64
+ There are more settings on the generated `Client` class which let you control more runtime behavior, check out the
65
+ docstring on that class for more info.
66
+
64
67
Things to know:
65
68
1. Every path/method combo becomes a Python module with four functions:
66
69
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
Original file line number Diff line number Diff line change @@ -4,7 +4,19 @@ import attr
4
4
5
5
@attr.s(auto_attribs=True)
6
6
class Client:
7
- """ A class for keeping track of data related to the API """
7
+ """ A class for keeping track of data related to the API
8
+
9
+ Attributes:
10
+ base_url: The base URL for the API, all requests are made to a relative path to this URL
11
+ cookies: A dictionary of cookies to be sent with every request
12
+ headers: A dictionary of headers to be sent with every request
13
+ timeout: The maximum amount of a time a request can take. API functions will raise httpx.TimeoutException if
14
+ this is exceeded.
15
+ verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production,
16
+ but can be set to False for testing purposes.
17
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatusException if the API returns a
18
+ status code that was not documented in the source OpenAPI document.
19
+ """
8
20
9
21
base_url: str
10
22
cookies: Dict[str, str] = attr.ib(factory=dict, kw_only=True)
You can’t perform that action at this time.
0 commit comments