Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
d643fde917
|
|||
19b6cb7496
|
|||
37fb483ddf | |||
dc55b70536 | |||
c88eab236b | |||
f661f86533 | |||
18b5b998a8 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,3 +21,4 @@ dmypy.json
|
||||
|
||||
/coverage.xml
|
||||
/.coverage
|
||||
.vscode
|
20
README.md
20
README.md
@@ -1,11 +1,11 @@
|
||||
# PhotosAPI_Client
|
||||
A client library for accessing END PLAY Photos
|
||||
A client library for accessing Photos API
|
||||
|
||||
## Usage
|
||||
First, create a client:
|
||||
|
||||
```python
|
||||
from PhotosAPI_Client import Client
|
||||
from photosapi_client import Client
|
||||
|
||||
client = Client(base_url="https://api.example.com")
|
||||
```
|
||||
@@ -13,7 +13,7 @@ client = Client(base_url="https://api.example.com")
|
||||
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
||||
|
||||
```python
|
||||
from PhotosAPI_Client import AuthenticatedClient
|
||||
from photosapi_client import AuthenticatedClient
|
||||
|
||||
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
||||
```
|
||||
@@ -21,9 +21,9 @@ client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSec
|
||||
Now call your endpoint and use your models:
|
||||
|
||||
```python
|
||||
from PhotosAPI_Client.models import MyDataModel
|
||||
from PhotosAPI_Client.api.my_tag import get_my_data_model
|
||||
from PhotosAPI_Client.types import Response
|
||||
from photosapi_client.models import MyDataModel
|
||||
from photosapi_client.api.my_tag import get_my_data_model
|
||||
from photosapi_client.types import Response
|
||||
|
||||
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
||||
# or if you need more info (e.g. status_code)
|
||||
@@ -33,9 +33,9 @@ response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
||||
Or do the same thing with an async version:
|
||||
|
||||
```python
|
||||
from PhotosAPI_Client.models import MyDataModel
|
||||
from PhotosAPI_Client.api.my_tag import get_my_data_model
|
||||
from PhotosAPI_Client.types import Response
|
||||
from photosapi_client.models import MyDataModel
|
||||
from photosapi_client.api.my_tag import get_my_data_model
|
||||
from photosapi_client.types import Response
|
||||
|
||||
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
||||
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
||||
@@ -72,7 +72,7 @@ Things to know:
|
||||
|
||||
1. All path/query params, and bodies become method arguments.
|
||||
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)
|
||||
1. Any endpoint which did not have a tag will be in `PhotosAPI_Client.api.default`
|
||||
1. Any endpoint which did not have a tag will be in `photosapi_client.api.default`
|
||||
|
||||
## Building / publishing this Client
|
||||
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
|
||||
|
2
config.yaml
Normal file
2
config.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
project_name_override: PhotosAPI_Client
|
||||
package_name_override: photosapi_client
|
@@ -34,6 +34,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -54,7 +55,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -123,7 +124,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Album, Any, HTTPValidationError]]
|
||||
Union[Album, Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -186,7 +187,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Album, Any, HTTPValidationError]]
|
||||
Union[Album, Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -25,6 +25,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +41,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -104,7 +105,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -161,7 +162,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -31,6 +31,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ def _parse_response(
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -113,7 +114,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, SearchResultsAlbum]]
|
||||
Union[HTTPValidationError, SearchResultsAlbum]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -170,7 +171,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, SearchResultsAlbum]]
|
||||
Union[HTTPValidationError, SearchResultsAlbum]
|
||||
"""
|
||||
|
||||
return (
|
@@ -38,6 +38,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ def _parse_response(
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -141,7 +142,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
Union[AlbumModified, Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -216,7 +217,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
Union[AlbumModified, Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -38,6 +38,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ def _parse_response(
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -141,7 +142,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
Union[AlbumModified, Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -216,7 +217,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AlbumModified, Any, HTTPValidationError]]
|
||||
Union[AlbumModified, Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -27,6 +27,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"data": form_data.to_dict(),
|
||||
}
|
||||
|
||||
@@ -44,7 +45,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -98,7 +99,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Token]]
|
||||
Union[Any, HTTPValidationError, Token]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -145,7 +146,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Token]]
|
||||
Union[Any, HTTPValidationError, Token]
|
||||
"""
|
||||
|
||||
return (
|
@@ -25,6 +25,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +41,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -104,7 +105,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -161,7 +162,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -15,6 +15,7 @@ def _get_kwargs(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
@@ -31,6 +32,8 @@ def _get_kwargs(
|
||||
|
||||
params["caption"] = caption
|
||||
|
||||
params["token"] = token
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["page_size"] = page_size
|
||||
@@ -49,6 +52,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -61,6 +65,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
response_401 = cast(Any, None)
|
||||
return response_401
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
@@ -68,7 +75,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
response_422 = cast(Any, None)
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -88,6 +95,7 @@ def sync_detailed(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
@@ -96,12 +104,13 @@ def sync_detailed(
|
||||
) -> Response[Union[Any, SearchResultsPhoto]]:
|
||||
"""Photo Find
|
||||
|
||||
Find a photo by filename
|
||||
Find a photo by filename, caption, location or token
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
lat (Union[Unset, None, float]):
|
||||
@@ -121,6 +130,7 @@ def sync_detailed(
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
lat=lat,
|
||||
@@ -142,6 +152,7 @@ def sync(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
@@ -150,12 +161,13 @@ def sync(
|
||||
) -> Optional[Union[Any, SearchResultsPhoto]]:
|
||||
"""Photo Find
|
||||
|
||||
Find a photo by filename
|
||||
Find a photo by filename, caption, location or token
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
lat (Union[Unset, None, float]):
|
||||
@@ -167,7 +179,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, SearchResultsPhoto]]
|
||||
Union[Any, SearchResultsPhoto]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -175,6 +187,7 @@ def sync(
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
lat=lat,
|
||||
@@ -189,6 +202,7 @@ async def asyncio_detailed(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
@@ -197,12 +211,13 @@ async def asyncio_detailed(
|
||||
) -> Response[Union[Any, SearchResultsPhoto]]:
|
||||
"""Photo Find
|
||||
|
||||
Find a photo by filename
|
||||
Find a photo by filename, caption, location or token
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
lat (Union[Unset, None, float]):
|
||||
@@ -222,6 +237,7 @@ async def asyncio_detailed(
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
lat=lat,
|
||||
@@ -241,6 +257,7 @@ async def asyncio(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
lat: Union[Unset, None, float] = UNSET,
|
||||
@@ -249,12 +266,13 @@ async def asyncio(
|
||||
) -> Optional[Union[Any, SearchResultsPhoto]]:
|
||||
"""Photo Find
|
||||
|
||||
Find a photo by filename
|
||||
Find a photo by filename, caption, location or token
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
lat (Union[Unset, None, float]):
|
||||
@@ -266,7 +284,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, SearchResultsPhoto]]
|
||||
Union[Any, SearchResultsPhoto]
|
||||
"""
|
||||
|
||||
return (
|
||||
@@ -275,6 +293,7 @@ async def asyncio(
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
lat=lat,
|
@@ -25,13 +25,11 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = cast(Any, response.json())
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
@@ -40,7 +38,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -104,7 +102,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -161,7 +159,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -31,6 +31,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -50,7 +51,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -119,7 +120,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -182,7 +183,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -32,6 +32,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ def _parse_response(
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -122,7 +123,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, PhotoPublic]]
|
||||
Union[Any, HTTPValidationError, PhotoPublic]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -185,7 +186,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, PhotoPublic]]
|
||||
Union[Any, HTTPValidationError, PhotoPublic]
|
||||
"""
|
||||
|
||||
return (
|
@@ -32,6 +32,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ def _parse_response(
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -122,7 +123,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, PhotoPublic]]
|
||||
Union[Any, HTTPValidationError, PhotoPublic]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -185,7 +186,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, PhotoPublic]]
|
||||
Union[Any, HTTPValidationError, PhotoPublic]
|
||||
"""
|
||||
|
||||
return (
|
@@ -42,6 +42,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"files": multipart_multipart_data,
|
||||
"params": params,
|
||||
}
|
||||
@@ -63,7 +64,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -147,7 +148,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Photo]]
|
||||
Union[Any, HTTPValidationError, Photo]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -228,7 +229,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Photo]]
|
||||
Union[Any, HTTPValidationError, Photo]
|
||||
"""
|
||||
|
||||
return (
|
@@ -31,6 +31,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -112,7 +113,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -171,7 +172,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -31,6 +31,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -112,7 +113,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -171,7 +172,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -26,6 +26,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"data": form_data.to_dict(),
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -96,7 +97,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -143,7 +144,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -26,6 +26,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"data": form_data.to_dict(),
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -96,7 +97,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -143,7 +144,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -24,6 +24,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +34,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Use
|
||||
|
||||
return response_200
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -84,7 +85,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[User]
|
||||
User
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -127,7 +128,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[User]
|
||||
User
|
||||
"""
|
||||
|
||||
return (
|
@@ -25,6 +25,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +41,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -104,7 +105,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -161,7 +162,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -15,6 +15,7 @@ def _get_kwargs(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
) -> Dict[str, Any]:
|
||||
@@ -28,6 +29,8 @@ def _get_kwargs(
|
||||
|
||||
params["caption"] = caption
|
||||
|
||||
params["token"] = token
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["page_size"] = page_size
|
||||
@@ -40,6 +43,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -52,6 +56,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
response_401 = cast(Any, None)
|
||||
return response_401
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
@@ -59,7 +66,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
response_422 = cast(Any, None)
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -79,17 +86,19 @@ def sync_detailed(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
) -> Response[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
Find a video by filename
|
||||
Find a video by filename, caption or token
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
|
||||
@@ -106,6 +115,7 @@ def sync_detailed(
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
)
|
||||
@@ -124,17 +134,19 @@ def sync(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
) -> Optional[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
Find a video by filename
|
||||
Find a video by filename, caption or token
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
|
||||
@@ -143,7 +155,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, SearchResultsVideo]]
|
||||
Union[Any, SearchResultsVideo]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -151,6 +163,7 @@ def sync(
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
).parsed
|
||||
@@ -162,17 +175,19 @@ async def asyncio_detailed(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
) -> Response[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
Find a video by filename
|
||||
Find a video by filename, caption or token
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
|
||||
@@ -189,6 +204,7 @@ async def asyncio_detailed(
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
)
|
||||
@@ -205,17 +221,19 @@ async def asyncio(
|
||||
client: AuthenticatedClient,
|
||||
q: Union[Unset, None, str] = UNSET,
|
||||
caption: Union[Unset, None, str] = UNSET,
|
||||
token: Union[Unset, None, str] = UNSET,
|
||||
page: Union[Unset, None, int] = 1,
|
||||
page_size: Union[Unset, None, int] = 100,
|
||||
) -> Optional[Union[Any, SearchResultsVideo]]:
|
||||
"""Video Find
|
||||
|
||||
Find a video by filename
|
||||
Find a video by filename, caption or token
|
||||
|
||||
Args:
|
||||
album (str):
|
||||
q (Union[Unset, None, str]):
|
||||
caption (Union[Unset, None, str]):
|
||||
token (Union[Unset, None, str]):
|
||||
page (Union[Unset, None, int]): Default: 1.
|
||||
page_size (Union[Unset, None, int]): Default: 100.
|
||||
|
||||
@@ -224,7 +242,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, SearchResultsVideo]]
|
||||
Union[Any, SearchResultsVideo]
|
||||
"""
|
||||
|
||||
return (
|
||||
@@ -233,6 +251,7 @@ async def asyncio(
|
||||
client=client,
|
||||
q=q,
|
||||
caption=caption,
|
||||
token=token,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
)
|
@@ -25,13 +25,11 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = cast(Any, response.json())
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
@@ -40,7 +38,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -104,7 +102,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -161,7 +159,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
@@ -32,6 +32,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ def _parse_response(
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -122,7 +123,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, VideoPublic]]
|
||||
Union[Any, HTTPValidationError, VideoPublic]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -185,7 +186,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, VideoPublic]]
|
||||
Union[Any, HTTPValidationError, VideoPublic]
|
||||
"""
|
||||
|
||||
return (
|
@@ -32,6 +32,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ def _parse_response(
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -122,7 +123,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, VideoPublic]]
|
||||
Union[Any, HTTPValidationError, VideoPublic]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -185,7 +186,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, VideoPublic]]
|
||||
Union[Any, HTTPValidationError, VideoPublic]
|
||||
"""
|
||||
|
||||
return (
|
@@ -36,6 +36,7 @@ def _get_kwargs(
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
"follow_redirects": client.follow_redirects,
|
||||
"files": multipart_multipart_data,
|
||||
"params": params,
|
||||
}
|
||||
@@ -54,7 +55,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
|
||||
|
||||
return response_422
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -128,7 +129,7 @@ def sync(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Video]]
|
||||
Union[Any, HTTPValidationError, Video]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
@@ -197,7 +198,7 @@ async def asyncio(
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError, Video]]
|
||||
Union[Any, HTTPValidationError, Video]
|
||||
"""
|
||||
|
||||
return (
|
@@ -18,6 +18,7 @@ class Client:
|
||||
but can be set to False for testing purposes.
|
||||
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||
status code that was not documented in the source OpenAPI document.
|
||||
follow_redirects: Whether or not to follow redirects. Default value is False.
|
||||
"""
|
||||
|
||||
base_url: str
|
||||
@@ -26,6 +27,7 @@ class Client:
|
||||
timeout: float = attr.ib(5.0, kw_only=True)
|
||||
verify_ssl: Union[str, bool, ssl.SSLContext] = attr.ib(True, kw_only=True)
|
||||
raise_on_unexpected_status: bool = attr.ib(False, kw_only=True)
|
||||
follow_redirects: bool = attr.ib(False, kw_only=True)
|
||||
|
||||
def get_headers(self) -> Dict[str, str]:
|
||||
"""Get headers to be used in all endpoints"""
|
@@ -4,7 +4,11 @@
|
||||
class UnexpectedStatus(Exception):
|
||||
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
||||
|
||||
...
|
||||
def __init__(self, status_code: int, content: bytes):
|
||||
self.status_code = status_code
|
||||
self.content = content
|
||||
|
||||
super().__init__(f"Unexpected status code: {status_code}")
|
||||
|
||||
|
||||
__all__ = ["UnexpectedStatus"]
|
@@ -1,12 +1,12 @@
|
||||
""" Contains some shared types for properties """
|
||||
from http import HTTPStatus
|
||||
from typing import BinaryIO, Generic, MutableMapping, Optional, Tuple, TypeVar
|
||||
from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar
|
||||
|
||||
import attr
|
||||
|
||||
|
||||
class Unset:
|
||||
def __bool__(self) -> bool:
|
||||
def __bool__(self) -> Literal[False]:
|
||||
return False
|
||||
|
||||
|
6
setup.py
6
setup.py
@@ -7,12 +7,12 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
|
||||
|
||||
setup(
|
||||
name="PhotosAPI_Client",
|
||||
version="0.1",
|
||||
description="A client library for accessing END PLAY Photos",
|
||||
version="0.3.0",
|
||||
description="A client library for accessing Photos API",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
packages=find_packages(),
|
||||
python_requires=">=3.7, <4",
|
||||
install_requires=["httpx >= 0.15.0, < 0.24.0", "attrs >= 21.3.0", "python-dateutil >= 2.8.0, < 3"],
|
||||
package_data={"PhotosAPI_Client": ["py.typed"]},
|
||||
package_data={"photosapi_client": ["py.typed"]},
|
||||
)
|
||||
|
Reference in New Issue
Block a user