Compare commits

...

8 Commits

Author SHA1 Message Date
a1c41cbd17
Improved MD compliance 2023-11-25 20:20:15 +01:00
a4f6bb2a25
Updated to PhotosAPI v0.5.0 2023-06-27 14:03:49 +02:00
c05c588768
Updated post-hooks 2023-06-23 13:09:43 +02:00
6d4b848568
Updated specs to API version 0.4 2023-06-22 14:46:58 +02:00
d643fde917
Updated to PhotosAPI v3.0 2023-06-22 14:38:42 +02:00
19b6cb7496
Added generator config 2023-06-22 14:37:49 +02:00
37fb483ddf Slightly changed README 2023-03-23 12:51:10 +01:00
dc55b70536 Updated to API version 0.2 2023-03-23 12:44:02 +01:00
35 changed files with 768 additions and 106 deletions

View File

@ -1,7 +1,9 @@
# PhotosAPI_Client
A client library for accessing END PLAY Photos
A client library for accessing Photos API
## Usage
First, create a client:
```python
@ -64,6 +66,7 @@ client = AuthenticatedClient(
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.
Things to know:
1. Every path/method combo becomes a Python module with four functions:
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
@ -75,7 +78,9 @@ Things to know:
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:
1. Update the metadata in pyproject.toml (e.g. authors, version)
1. If you're using a private repository, configure it with Poetry
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
@ -83,6 +88,7 @@ This project uses [Poetry](https://python-poetry.org/) to manage dependencies a
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
If you want to install this client into another project without publishing it (e.g. for development) then:
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
1. If that project is not using Poetry:
1. Build a wheel with `poetry build -f wheel`

6
config.yaml Normal file
View File

@ -0,0 +1,6 @@
project_name_override: PhotosAPI_Client
package_name_override: photosapi_client
post_hooks:
- "autoflake -i -r --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports photosapi_client/"
- "isort photosapi_client/"
- "black photosapi_client/"

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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,

View File

@ -1,4 +1,5 @@
from http import HTTPStatus
from io import BytesIO
from typing import Any, Dict, Optional, Union, cast
import httpx
@ -6,7 +7,7 @@ import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.http_validation_error import HTTPValidationError
from ...types import Response
from ...types import File, Response
def _get_kwargs(
@ -25,12 +26,14 @@ 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]]:
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, File, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK:
response_200 = cast(Any, response.json())
response_200 = File(payload=BytesIO(response.content))
return response_200
if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None)
@ -40,12 +43,12 @@ 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
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, File, HTTPValidationError]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
@ -58,7 +61,7 @@ def sync_detailed(
id: str,
*,
client: AuthenticatedClient,
) -> Response[Union[Any, HTTPValidationError]]:
) -> Response[Union[Any, File, HTTPValidationError]]:
"""Photo Get
Get a photo by id
@ -71,7 +74,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError]]
Response[Union[Any, File, HTTPValidationError]]
"""
kwargs = _get_kwargs(
@ -91,7 +94,7 @@ def sync(
id: str,
*,
client: AuthenticatedClient,
) -> Optional[Union[Any, HTTPValidationError]]:
) -> Optional[Union[Any, File, HTTPValidationError]]:
"""Photo Get
Get a photo by id
@ -104,7 +107,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError]]
Union[Any, File, HTTPValidationError]
"""
return sync_detailed(
@ -117,7 +120,7 @@ async def asyncio_detailed(
id: str,
*,
client: AuthenticatedClient,
) -> Response[Union[Any, HTTPValidationError]]:
) -> Response[Union[Any, File, HTTPValidationError]]:
"""Photo Get
Get a photo by id
@ -130,7 +133,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError]]
Response[Union[Any, File, HTTPValidationError]]
"""
kwargs = _get_kwargs(
@ -148,7 +151,7 @@ async def asyncio(
id: str,
*,
client: AuthenticatedClient,
) -> Optional[Union[Any, HTTPValidationError]]:
) -> Optional[Union[Any, File, HTTPValidationError]]:
"""Photo Get
Get a photo by id
@ -161,7 +164,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError]]
Union[Any, File, HTTPValidationError]
"""
return (

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -0,0 +1,216 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union, cast
import httpx
from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.http_validation_error import HTTPValidationError
from ...models.random_search_results_photo import RandomSearchResultsPhoto
from ...types import UNSET, Response, Unset
def _get_kwargs(
album: str,
*,
client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET,
limit: Union[Unset, None, int] = 100,
) -> Dict[str, Any]:
url = "{}/albums/{album}/photos/random".format(client.base_url, album=album)
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()
params: Dict[str, Any] = {}
params["caption"] = caption
params["limit"] = limit
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
return {
"method": "get",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params,
}
def _parse_response(
*, client: Client, response: httpx.Response
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
if response.status_code == HTTPStatus.OK:
response_200 = RandomSearchResultsPhoto.from_dict(response.json())
return response_200
if response.status_code == HTTPStatus.BAD_REQUEST:
response_400 = cast(Any, None)
return response_400
if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None)
return response_404
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
response_422 = HTTPValidationError.from_dict(response.json())
return response_422
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None
def _build_response(
*, client: Client, response: httpx.Response
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)
def sync_detailed(
album: str,
*,
client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET,
limit: Union[Unset, None, int] = 100,
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
"""Photo Random
Get one random photo, optionally by caption
Args:
album (str):
caption (Union[Unset, None, str]):
limit (Union[Unset, None, int]): Default: 100.
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]
"""
kwargs = _get_kwargs(
album=album,
client=client,
caption=caption,
limit=limit,
)
response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)
return _build_response(client=client, response=response)
def sync(
album: str,
*,
client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET,
limit: Union[Unset, None, int] = 100,
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
"""Photo Random
Get one random photo, optionally by caption
Args:
album (str):
caption (Union[Unset, None, str]):
limit (Union[Unset, None, int]): Default: 100.
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, RandomSearchResultsPhoto]
"""
return sync_detailed(
album=album,
client=client,
caption=caption,
limit=limit,
).parsed
async def asyncio_detailed(
album: str,
*,
client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET,
limit: Union[Unset, None, int] = 100,
) -> Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
"""Photo Random
Get one random photo, optionally by caption
Args:
album (str):
caption (Union[Unset, None, str]):
limit (Union[Unset, None, int]): Default: 100.
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]
"""
kwargs = _get_kwargs(
album=album,
client=client,
caption=caption,
limit=limit,
)
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)
return _build_response(client=client, response=response)
async def asyncio(
album: str,
*,
client: AuthenticatedClient,
caption: Union[Unset, None, str] = UNSET,
limit: Union[Unset, None, int] = 100,
) -> Optional[Union[Any, HTTPValidationError, RandomSearchResultsPhoto]]:
"""Photo Random
Get one random photo, optionally by caption
Args:
album (str):
caption (Union[Unset, None, str]):
limit (Union[Unset, None, int]): Default: 100.
Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, RandomSearchResultsPhoto]
"""
return (
await asyncio_detailed(
album=album,
client=client,
caption=caption,
limit=limit,
)
).parsed

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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