naurt-api 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- naurt_api-0.1.0/LICENSE +21 -0
- naurt_api-0.1.0/PKG-INFO +151 -0
- naurt_api-0.1.0/README.md +124 -0
- naurt_api-0.1.0/naurt_api/__init__.py +8 -0
- naurt_api-0.1.0/naurt_api/api/__init__.py +1 -0
- naurt_api-0.1.0/naurt_api/api/feedback/__init__.py +1 -0
- naurt_api-0.1.0/naurt_api/api/feedback/feedback_options.py +150 -0
- naurt_api-0.1.0/naurt_api/api/feedback/feedback_post.py +231 -0
- naurt_api-0.1.0/naurt_api/api/final_destination/__init__.py +1 -0
- naurt_api-0.1.0/naurt_api/api/final_destination/finaldestination_options.py +150 -0
- naurt_api-0.1.0/naurt_api/api/final_destination/finaldestination_post.py +310 -0
- naurt_api-0.1.0/naurt_api/api/rendezvous/__init__.py +1 -0
- naurt_api-0.1.0/naurt_api/api/rendezvous/rendezvous_options.py +158 -0
- naurt_api-0.1.0/naurt_api/api/rendezvous/rendezvous_post.py +215 -0
- naurt_api-0.1.0/naurt_api/client.py +271 -0
- naurt_api-0.1.0/naurt_api/errors.py +14 -0
- naurt_api-0.1.0/naurt_api/models/__init__.py +91 -0
- naurt_api-0.1.0/naurt_api/models/accuracy.py +80 -0
- naurt_api-0.1.0/naurt_api/models/accuracy_quality.py +9 -0
- naurt_api-0.1.0/naurt_api/models/country.py +42 -0
- naurt_api-0.1.0/naurt_api/models/error_response.py +81 -0
- naurt_api-0.1.0/naurt_api/models/feature.py +150 -0
- naurt_api-0.1.0/naurt_api/models/feature_collection.py +106 -0
- naurt_api-0.1.0/naurt_api/models/feature_collection_type.py +7 -0
- naurt_api-0.1.0/naurt_api/models/feature_properties.py +114 -0
- naurt_api-0.1.0/naurt_api/models/feature_properties_naurt_type.py +10 -0
- naurt_api-0.1.0/naurt_api/models/feature_type.py +7 -0
- naurt_api-0.1.0/naurt_api/models/feedback_location.py +66 -0
- naurt_api-0.1.0/naurt_api/models/feedback_query.py +124 -0
- naurt_api-0.1.0/naurt_api/models/feedback_request.py +76 -0
- naurt_api-0.1.0/naurt_api/models/feedback_response.py +58 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_hit.py +187 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_hits.py +148 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_location.py +82 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_logging.py +94 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_options.py +150 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_query.py +217 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_request.py +101 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_response.py +121 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_source_id_request.py +60 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_source_id_response.py +75 -0
- naurt_api-0.1.0/naurt_api/models/final_destination_status.py +8 -0
- naurt_api-0.1.0/naurt_api/models/geojson_type.py +8 -0
- naurt_api-0.1.0/naurt_api/models/input_filter.py +9 -0
- naurt_api-0.1.0/naurt_api/models/key_value.py +156 -0
- naurt_api-0.1.0/naurt_api/models/language.py +22 -0
- naurt_api-0.1.0/naurt_api/models/multipoint.py +117 -0
- naurt_api-0.1.0/naurt_api/models/multipoint_type.py +7 -0
- naurt_api-0.1.0/naurt_api/models/options_response.py +70 -0
- naurt_api-0.1.0/naurt_api/models/point.py +92 -0
- naurt_api-0.1.0/naurt_api/models/point_type.py +7 -0
- naurt_api-0.1.0/naurt_api/models/polygon.py +112 -0
- naurt_api-0.1.0/naurt_api/models/polygon_type.py +7 -0
- naurt_api-0.1.0/naurt_api/models/rendezvous_hit.py +87 -0
- naurt_api-0.1.0/naurt_api/models/rendezvous_hit_data.py +93 -0
- naurt_api-0.1.0/naurt_api/models/rendezvous_options.py +66 -0
- naurt_api-0.1.0/naurt_api/models/rendezvous_query.py +104 -0
- naurt_api-0.1.0/naurt_api/models/rendezvous_request.py +100 -0
- naurt_api-0.1.0/naurt_api/models/rendezvous_response.py +144 -0
- naurt_api-0.1.0/naurt_api/models/structured_address.py +144 -0
- naurt_api-0.1.0/naurt_api/py.typed +1 -0
- naurt_api-0.1.0/naurt_api/types.py +53 -0
- naurt_api-0.1.0/pyproject.toml +41 -0
naurt_api-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Naurt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
naurt_api-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: naurt-api
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A client library for accessing Naurt API
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: naurt,api,geospatial,address,location
|
|
8
|
+
Author: Indigo Curnick
|
|
9
|
+
Author-email: indigo.c@naurt.com
|
|
10
|
+
Requires-Python: >=3.10,<4.0
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Requires-Dist: attrs (>=22.2.0)
|
|
20
|
+
Requires-Dist: httpx (>=0.23.0,<0.29.0)
|
|
21
|
+
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
|
|
22
|
+
Project-URL: Documentation, https://docs.naurt.com
|
|
23
|
+
Project-URL: Homepage, https://naurt.com
|
|
24
|
+
Project-URL: Repository, https://github.com/Naurt-Ltd/api_specification
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# naurt_api
|
|
28
|
+
A client library for accessing Naurt API
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
First, create a client:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from naurt_api import Client
|
|
35
|
+
|
|
36
|
+
client = Client(base_url="https://api.example.com")
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from naurt_api import AuthenticatedClient
|
|
43
|
+
|
|
44
|
+
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Now call your endpoint and use your models:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from naurt_api.models import MyDataModel
|
|
51
|
+
from naurt_api.api.my_tag import get_my_data_model
|
|
52
|
+
from naurt_api.types import Response
|
|
53
|
+
|
|
54
|
+
with client as client:
|
|
55
|
+
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
|
56
|
+
# or if you need more info (e.g. status_code)
|
|
57
|
+
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Or do the same thing with an async version:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from naurt_api.models import MyDataModel
|
|
64
|
+
from naurt_api.api.my_tag import get_my_data_model
|
|
65
|
+
from naurt_api.types import Response
|
|
66
|
+
|
|
67
|
+
async with client as client:
|
|
68
|
+
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
|
69
|
+
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
client = AuthenticatedClient(
|
|
76
|
+
base_url="https://internal_api.example.com",
|
|
77
|
+
token="SuperSecretToken",
|
|
78
|
+
verify_ssl="/path/to/certificate_bundle.pem",
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
client = AuthenticatedClient(
|
|
86
|
+
base_url="https://internal_api.example.com",
|
|
87
|
+
token="SuperSecretToken",
|
|
88
|
+
verify_ssl=False
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Things to know:
|
|
93
|
+
1. Every path/method combo becomes a Python module with four functions:
|
|
94
|
+
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
|
95
|
+
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
|
96
|
+
1. `asyncio`: Like `sync` but async instead of blocking
|
|
97
|
+
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
|
98
|
+
|
|
99
|
+
1. All path/query params, and bodies become method arguments.
|
|
100
|
+
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)
|
|
101
|
+
1. Any endpoint which did not have a tag will be in `naurt_api.api.default`
|
|
102
|
+
|
|
103
|
+
## Advanced customizations
|
|
104
|
+
|
|
105
|
+
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from naurt_api import Client
|
|
109
|
+
|
|
110
|
+
def log_request(request):
|
|
111
|
+
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
|
112
|
+
|
|
113
|
+
def log_response(response):
|
|
114
|
+
request = response.request
|
|
115
|
+
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
|
116
|
+
|
|
117
|
+
client = Client(
|
|
118
|
+
base_url="https://api.example.com",
|
|
119
|
+
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
import httpx
|
|
129
|
+
from naurt_api import Client
|
|
130
|
+
|
|
131
|
+
client = Client(
|
|
132
|
+
base_url="https://api.example.com",
|
|
133
|
+
)
|
|
134
|
+
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
|
135
|
+
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Building / publishing this package
|
|
139
|
+
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
|
|
140
|
+
1. Update the metadata in pyproject.toml (e.g. authors, version)
|
|
141
|
+
1. If you're using a private repository, configure it with Poetry
|
|
142
|
+
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
|
|
143
|
+
1. `poetry config http-basic.<your-repository-name> <username> <password>`
|
|
144
|
+
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
|
|
145
|
+
|
|
146
|
+
If you want to install this client into another project without publishing it (e.g. for development) then:
|
|
147
|
+
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
|
|
148
|
+
1. If that project is not using Poetry:
|
|
149
|
+
1. Build a wheel with `poetry build -f wheel`
|
|
150
|
+
1. Install that wheel from the other project `pip install <path-to-wheel>`
|
|
151
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# naurt_api
|
|
2
|
+
A client library for accessing Naurt API
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
First, create a client:
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from naurt_api import Client
|
|
9
|
+
|
|
10
|
+
client = Client(base_url="https://api.example.com")
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from naurt_api import AuthenticatedClient
|
|
17
|
+
|
|
18
|
+
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Now call your endpoint and use your models:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from naurt_api.models import MyDataModel
|
|
25
|
+
from naurt_api.api.my_tag import get_my_data_model
|
|
26
|
+
from naurt_api.types import Response
|
|
27
|
+
|
|
28
|
+
with client as client:
|
|
29
|
+
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
|
30
|
+
# or if you need more info (e.g. status_code)
|
|
31
|
+
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or do the same thing with an async version:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from naurt_api.models import MyDataModel
|
|
38
|
+
from naurt_api.api.my_tag import get_my_data_model
|
|
39
|
+
from naurt_api.types import Response
|
|
40
|
+
|
|
41
|
+
async with client as client:
|
|
42
|
+
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
|
43
|
+
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
client = AuthenticatedClient(
|
|
50
|
+
base_url="https://internal_api.example.com",
|
|
51
|
+
token="SuperSecretToken",
|
|
52
|
+
verify_ssl="/path/to/certificate_bundle.pem",
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
client = AuthenticatedClient(
|
|
60
|
+
base_url="https://internal_api.example.com",
|
|
61
|
+
token="SuperSecretToken",
|
|
62
|
+
verify_ssl=False
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Things to know:
|
|
67
|
+
1. Every path/method combo becomes a Python module with four functions:
|
|
68
|
+
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
|
69
|
+
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
|
70
|
+
1. `asyncio`: Like `sync` but async instead of blocking
|
|
71
|
+
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
|
72
|
+
|
|
73
|
+
1. All path/query params, and bodies become method arguments.
|
|
74
|
+
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)
|
|
75
|
+
1. Any endpoint which did not have a tag will be in `naurt_api.api.default`
|
|
76
|
+
|
|
77
|
+
## Advanced customizations
|
|
78
|
+
|
|
79
|
+
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from naurt_api import Client
|
|
83
|
+
|
|
84
|
+
def log_request(request):
|
|
85
|
+
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
|
86
|
+
|
|
87
|
+
def log_response(response):
|
|
88
|
+
request = response.request
|
|
89
|
+
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
|
90
|
+
|
|
91
|
+
client = Client(
|
|
92
|
+
base_url="https://api.example.com",
|
|
93
|
+
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
import httpx
|
|
103
|
+
from naurt_api import Client
|
|
104
|
+
|
|
105
|
+
client = Client(
|
|
106
|
+
base_url="https://api.example.com",
|
|
107
|
+
)
|
|
108
|
+
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
|
109
|
+
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Building / publishing this package
|
|
113
|
+
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
|
|
114
|
+
1. Update the metadata in pyproject.toml (e.g. authors, version)
|
|
115
|
+
1. If you're using a private repository, configure it with Poetry
|
|
116
|
+
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
|
|
117
|
+
1. `poetry config http-basic.<your-repository-name> <username> <password>`
|
|
118
|
+
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
|
|
119
|
+
|
|
120
|
+
If you want to install this client into another project without publishing it (e.g. for development) then:
|
|
121
|
+
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
|
|
122
|
+
1. If that project is not using Poetry:
|
|
123
|
+
1. Build a wheel with `poetry build -f wheel`
|
|
124
|
+
1. Install that wheel from the other project `pip install <path-to-wheel>`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains methods for accessing the API """
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.options_response import OptionsResponse
|
|
12
|
+
from typing import cast
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
_kwargs: dict[str, Any] = {
|
|
26
|
+
"method": "options",
|
|
27
|
+
"url": "/feedback/v2",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> OptionsResponse | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = OptionsResponse.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
return response_200
|
|
42
|
+
|
|
43
|
+
if client.raise_on_unexpected_status:
|
|
44
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
45
|
+
else:
|
|
46
|
+
return None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[OptionsResponse]:
|
|
50
|
+
return Response(
|
|
51
|
+
status_code=HTTPStatus(response.status_code),
|
|
52
|
+
content=response.content,
|
|
53
|
+
headers=response.headers,
|
|
54
|
+
parsed=_parse_response(client=client, response=response),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def sync_detailed(
|
|
59
|
+
*,
|
|
60
|
+
client: AuthenticatedClient | Client,
|
|
61
|
+
|
|
62
|
+
) -> Response[OptionsResponse]:
|
|
63
|
+
""" Options
|
|
64
|
+
|
|
65
|
+
Raises:
|
|
66
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
67
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
Response[OptionsResponse]
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
kwargs = _get_kwargs(
|
|
75
|
+
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
response = client.get_httpx_client().request(
|
|
79
|
+
**kwargs,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
return _build_response(client=client, response=response)
|
|
83
|
+
|
|
84
|
+
def sync(
|
|
85
|
+
*,
|
|
86
|
+
client: AuthenticatedClient | Client,
|
|
87
|
+
|
|
88
|
+
) -> OptionsResponse | None:
|
|
89
|
+
""" Options
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
OptionsResponse
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
return sync_detailed(
|
|
101
|
+
client=client,
|
|
102
|
+
|
|
103
|
+
).parsed
|
|
104
|
+
|
|
105
|
+
async def asyncio_detailed(
|
|
106
|
+
*,
|
|
107
|
+
client: AuthenticatedClient | Client,
|
|
108
|
+
|
|
109
|
+
) -> Response[OptionsResponse]:
|
|
110
|
+
""" Options
|
|
111
|
+
|
|
112
|
+
Raises:
|
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
Response[OptionsResponse]
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
kwargs = _get_kwargs(
|
|
122
|
+
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
response = await client.get_async_httpx_client().request(
|
|
126
|
+
**kwargs
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
return _build_response(client=client, response=response)
|
|
130
|
+
|
|
131
|
+
async def asyncio(
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient | Client,
|
|
134
|
+
|
|
135
|
+
) -> OptionsResponse | None:
|
|
136
|
+
""" Options
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
140
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
OptionsResponse
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
return (await asyncio_detailed(
|
|
148
|
+
client=client,
|
|
149
|
+
|
|
150
|
+
)).parsed
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.feedback_request import FeedbackRequest
|
|
12
|
+
from ...models.feedback_response import FeedbackResponse
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
*,
|
|
19
|
+
body: FeedbackRequest,
|
|
20
|
+
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
_kwargs: dict[str, Any] = {
|
|
30
|
+
"method": "post",
|
|
31
|
+
"url": "/feedback/v2",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_kwargs["json"] = body.to_dict()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
headers["Content-Type"] = "application/json"
|
|
38
|
+
|
|
39
|
+
_kwargs["headers"] = headers
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | FeedbackResponse | None:
|
|
45
|
+
if response.status_code == 200:
|
|
46
|
+
response_200 = FeedbackResponse.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
return response_200
|
|
51
|
+
|
|
52
|
+
if response.status_code == 400:
|
|
53
|
+
response_400 = cast(Any, None)
|
|
54
|
+
return response_400
|
|
55
|
+
|
|
56
|
+
if response.status_code == 401:
|
|
57
|
+
response_401 = cast(Any, None)
|
|
58
|
+
return response_401
|
|
59
|
+
|
|
60
|
+
if response.status_code == 500:
|
|
61
|
+
response_500 = cast(Any, None)
|
|
62
|
+
return response_500
|
|
63
|
+
|
|
64
|
+
if client.raise_on_unexpected_status:
|
|
65
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
66
|
+
else:
|
|
67
|
+
return None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | FeedbackResponse]:
|
|
71
|
+
return Response(
|
|
72
|
+
status_code=HTTPStatus(response.status_code),
|
|
73
|
+
content=response.content,
|
|
74
|
+
headers=response.headers,
|
|
75
|
+
parsed=_parse_response(client=client, response=response),
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def sync_detailed(
|
|
80
|
+
*,
|
|
81
|
+
client: AuthenticatedClient,
|
|
82
|
+
body: FeedbackRequest,
|
|
83
|
+
|
|
84
|
+
) -> Response[Any | FeedbackResponse]:
|
|
85
|
+
""" Post
|
|
86
|
+
|
|
87
|
+
Submit feedback to Naurt for address, parking location, or door location data.
|
|
88
|
+
|
|
89
|
+
This endpoint can be used to:
|
|
90
|
+
- suggest corrections to existing Naurt address data
|
|
91
|
+
- suggest improved parking locations
|
|
92
|
+
- suggest improved door locations
|
|
93
|
+
- provide new address records where parking or door data is not yet available
|
|
94
|
+
|
|
95
|
+
A valid API key is required. Feedback submissions do not count against API usage.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
body (FeedbackRequest):
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Response[Any | FeedbackResponse]
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
kwargs = _get_kwargs(
|
|
110
|
+
body=body,
|
|
111
|
+
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
response = client.get_httpx_client().request(
|
|
115
|
+
**kwargs,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
return _build_response(client=client, response=response)
|
|
119
|
+
|
|
120
|
+
def sync(
|
|
121
|
+
*,
|
|
122
|
+
client: AuthenticatedClient,
|
|
123
|
+
body: FeedbackRequest,
|
|
124
|
+
|
|
125
|
+
) -> Any | FeedbackResponse | None:
|
|
126
|
+
""" Post
|
|
127
|
+
|
|
128
|
+
Submit feedback to Naurt for address, parking location, or door location data.
|
|
129
|
+
|
|
130
|
+
This endpoint can be used to:
|
|
131
|
+
- suggest corrections to existing Naurt address data
|
|
132
|
+
- suggest improved parking locations
|
|
133
|
+
- suggest improved door locations
|
|
134
|
+
- provide new address records where parking or door data is not yet available
|
|
135
|
+
|
|
136
|
+
A valid API key is required. Feedback submissions do not count against API usage.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
body (FeedbackRequest):
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
Any | FeedbackResponse
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
return sync_detailed(
|
|
151
|
+
client=client,
|
|
152
|
+
body=body,
|
|
153
|
+
|
|
154
|
+
).parsed
|
|
155
|
+
|
|
156
|
+
async def asyncio_detailed(
|
|
157
|
+
*,
|
|
158
|
+
client: AuthenticatedClient,
|
|
159
|
+
body: FeedbackRequest,
|
|
160
|
+
|
|
161
|
+
) -> Response[Any | FeedbackResponse]:
|
|
162
|
+
""" Post
|
|
163
|
+
|
|
164
|
+
Submit feedback to Naurt for address, parking location, or door location data.
|
|
165
|
+
|
|
166
|
+
This endpoint can be used to:
|
|
167
|
+
- suggest corrections to existing Naurt address data
|
|
168
|
+
- suggest improved parking locations
|
|
169
|
+
- suggest improved door locations
|
|
170
|
+
- provide new address records where parking or door data is not yet available
|
|
171
|
+
|
|
172
|
+
A valid API key is required. Feedback submissions do not count against API usage.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
body (FeedbackRequest):
|
|
176
|
+
|
|
177
|
+
Raises:
|
|
178
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
179
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
Response[Any | FeedbackResponse]
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
kwargs = _get_kwargs(
|
|
187
|
+
body=body,
|
|
188
|
+
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
response = await client.get_async_httpx_client().request(
|
|
192
|
+
**kwargs
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
return _build_response(client=client, response=response)
|
|
196
|
+
|
|
197
|
+
async def asyncio(
|
|
198
|
+
*,
|
|
199
|
+
client: AuthenticatedClient,
|
|
200
|
+
body: FeedbackRequest,
|
|
201
|
+
|
|
202
|
+
) -> Any | FeedbackResponse | None:
|
|
203
|
+
""" Post
|
|
204
|
+
|
|
205
|
+
Submit feedback to Naurt for address, parking location, or door location data.
|
|
206
|
+
|
|
207
|
+
This endpoint can be used to:
|
|
208
|
+
- suggest corrections to existing Naurt address data
|
|
209
|
+
- suggest improved parking locations
|
|
210
|
+
- suggest improved door locations
|
|
211
|
+
- provide new address records where parking or door data is not yet available
|
|
212
|
+
|
|
213
|
+
A valid API key is required. Feedback submissions do not count against API usage.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
body (FeedbackRequest):
|
|
217
|
+
|
|
218
|
+
Raises:
|
|
219
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
220
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
221
|
+
|
|
222
|
+
Returns:
|
|
223
|
+
Any | FeedbackResponse
|
|
224
|
+
"""
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
return (await asyncio_detailed(
|
|
228
|
+
client=client,
|
|
229
|
+
body=body,
|
|
230
|
+
|
|
231
|
+
)).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|