Compare commits

..

No commits in common. "d643fde9171b4b4063cfa4db9888d112d10c9b83" and "37fb483ddfb10c1e332c95146b59fee04ac517c0" have entirely different histories.

29 changed files with 82 additions and 108 deletions

View File

@ -1,2 +0,0 @@
project_name_override: PhotosAPI_Client
package_name_override: photosapi_client

View File

@ -34,7 +34,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -55,7 +54,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -124,7 +123,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Album, Any, HTTPValidationError] Response[Union[Album, Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -187,7 +186,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Album, Any, HTTPValidationError] Response[Union[Album, Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -25,7 +25,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
@ -41,7 +40,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -105,7 +104,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -162,7 +161,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -31,7 +31,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -48,7 +47,7 @@ def _parse_response(
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -114,7 +113,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[HTTPValidationError, SearchResultsAlbum] Response[Union[HTTPValidationError, SearchResultsAlbum]]
""" """
return sync_detailed( return sync_detailed(
@ -171,7 +170,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[HTTPValidationError, SearchResultsAlbum] Response[Union[HTTPValidationError, SearchResultsAlbum]]
""" """
return ( return (

View File

@ -38,7 +38,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -61,7 +60,7 @@ def _parse_response(
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -142,7 +141,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[AlbumModified, Any, HTTPValidationError] Response[Union[AlbumModified, Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -217,7 +216,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[AlbumModified, Any, HTTPValidationError] Response[Union[AlbumModified, Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -38,7 +38,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -61,7 +60,7 @@ def _parse_response(
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -142,7 +141,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[AlbumModified, Any, HTTPValidationError] Response[Union[AlbumModified, Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -217,7 +216,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[AlbumModified, Any, HTTPValidationError] Response[Union[AlbumModified, Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -27,7 +27,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"data": form_data.to_dict(), "data": form_data.to_dict(),
} }
@ -45,7 +44,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -99,7 +98,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, Token] Response[Union[Any, HTTPValidationError, Token]]
""" """
return sync_detailed( return sync_detailed(
@ -146,7 +145,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, Token] Response[Union[Any, HTTPValidationError, Token]]
""" """
return ( return (

View File

@ -25,7 +25,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
@ -41,7 +40,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -105,7 +104,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -162,7 +161,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -52,7 +52,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -75,7 +74,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
response_422 = cast(Any, None) response_422 = cast(Any, None)
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -179,7 +178,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, SearchResultsPhoto] Response[Union[Any, SearchResultsPhoto]]
""" """
return sync_detailed( return sync_detailed(
@ -284,7 +283,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, SearchResultsPhoto] Response[Union[Any, SearchResultsPhoto]]
""" """
return ( return (

View File

@ -25,11 +25,13 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "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, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK:
response_200 = cast(Any, response.json())
return response_200
if response.status_code == HTTPStatus.NOT_FOUND: if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None) response_404 = cast(Any, None)
return response_404 return response_404
@ -38,7 +40,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -102,7 +104,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -159,7 +161,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -31,7 +31,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -51,7 +50,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -120,7 +119,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -183,7 +182,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -32,7 +32,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -52,7 +51,7 @@ def _parse_response(
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -123,7 +122,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, PhotoPublic] Response[Union[Any, HTTPValidationError, PhotoPublic]]
""" """
return sync_detailed( return sync_detailed(
@ -186,7 +185,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, PhotoPublic] Response[Union[Any, HTTPValidationError, PhotoPublic]]
""" """
return ( return (

View File

@ -32,7 +32,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -52,7 +51,7 @@ def _parse_response(
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -123,7 +122,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, PhotoPublic] Response[Union[Any, HTTPValidationError, PhotoPublic]]
""" """
return sync_detailed( return sync_detailed(
@ -186,7 +185,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, PhotoPublic] Response[Union[Any, HTTPValidationError, PhotoPublic]]
""" """
return ( return (

View File

@ -42,7 +42,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"files": multipart_multipart_data, "files": multipart_multipart_data,
"params": params, "params": params,
} }
@ -64,7 +63,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -148,7 +147,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, Photo] Response[Union[Any, HTTPValidationError, Photo]]
""" """
return sync_detailed( return sync_detailed(
@ -229,7 +228,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, Photo] Response[Union[Any, HTTPValidationError, Photo]]
""" """
return ( return (

View File

@ -31,7 +31,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -48,7 +47,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -113,7 +112,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -172,7 +171,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -31,7 +31,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -48,7 +47,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -113,7 +112,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -172,7 +171,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -26,7 +26,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"data": form_data.to_dict(), "data": form_data.to_dict(),
} }
@ -43,7 +42,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -97,7 +96,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -144,7 +143,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -26,7 +26,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"data": form_data.to_dict(), "data": form_data.to_dict(),
} }
@ -43,7 +42,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -97,7 +96,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -144,7 +143,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -24,7 +24,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
@ -34,7 +33,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Use
return response_200 return response_200
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -85,7 +84,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
User Response[User]
""" """
return sync_detailed( return sync_detailed(
@ -128,7 +127,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
User Response[User]
""" """
return ( return (

View File

@ -25,7 +25,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
} }
@ -41,7 +40,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -105,7 +104,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -162,7 +161,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -43,7 +43,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -66,7 +65,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
response_422 = cast(Any, None) response_422 = cast(Any, None)
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -155,7 +154,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, SearchResultsVideo] Response[Union[Any, SearchResultsVideo]]
""" """
return sync_detailed( return sync_detailed(
@ -242,7 +241,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, SearchResultsVideo] Response[Union[Any, SearchResultsVideo]]
""" """
return ( return (

View File

@ -25,11 +25,13 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "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, HTTPValidationError]]:
if response.status_code == HTTPStatus.OK:
response_200 = cast(Any, response.json())
return response_200
if response.status_code == HTTPStatus.NOT_FOUND: if response.status_code == HTTPStatus.NOT_FOUND:
response_404 = cast(Any, None) response_404 = cast(Any, None)
return response_404 return response_404
@ -38,7 +40,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -102,7 +104,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return sync_detailed( return sync_detailed(
@ -159,7 +161,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError] Response[Union[Any, HTTPValidationError]]
""" """
return ( return (

View File

@ -32,7 +32,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -52,7 +51,7 @@ def _parse_response(
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -123,7 +122,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, VideoPublic] Response[Union[Any, HTTPValidationError, VideoPublic]]
""" """
return sync_detailed( return sync_detailed(
@ -186,7 +185,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, VideoPublic] Response[Union[Any, HTTPValidationError, VideoPublic]]
""" """
return ( return (

View File

@ -32,7 +32,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"params": params, "params": params,
} }
@ -52,7 +51,7 @@ def _parse_response(
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -123,7 +122,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, VideoPublic] Response[Union[Any, HTTPValidationError, VideoPublic]]
""" """
return sync_detailed( return sync_detailed(
@ -186,7 +185,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, VideoPublic] Response[Union[Any, HTTPValidationError, VideoPublic]]
""" """
return ( return (

View File

@ -36,7 +36,6 @@ def _get_kwargs(
"headers": headers, "headers": headers,
"cookies": cookies, "cookies": cookies,
"timeout": client.get_timeout(), "timeout": client.get_timeout(),
"follow_redirects": client.follow_redirects,
"files": multipart_multipart_data, "files": multipart_multipart_data,
"params": params, "params": params,
} }
@ -55,7 +54,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
return response_422 return response_422
if client.raise_on_unexpected_status: if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content) raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else: else:
return None return None
@ -129,7 +128,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, Video] Response[Union[Any, HTTPValidationError, Video]]
""" """
return sync_detailed( return sync_detailed(
@ -198,7 +197,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout. httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns: Returns:
Union[Any, HTTPValidationError, Video] Response[Union[Any, HTTPValidationError, Video]]
""" """
return ( return (

View File

@ -18,7 +18,6 @@ class Client:
but can be set to False for testing purposes. 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 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. 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 base_url: str
@ -27,7 +26,6 @@ class Client:
timeout: float = attr.ib(5.0, kw_only=True) timeout: float = attr.ib(5.0, kw_only=True)
verify_ssl: Union[str, bool, ssl.SSLContext] = attr.ib(True, 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) 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]: def get_headers(self) -> Dict[str, str]:
"""Get headers to be used in all endpoints""" """Get headers to be used in all endpoints"""

View File

@ -4,11 +4,7 @@
class UnexpectedStatus(Exception): class UnexpectedStatus(Exception):
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" """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"] __all__ = ["UnexpectedStatus"]

View File

@ -1,12 +1,12 @@
""" Contains some shared types for properties """ """ Contains some shared types for properties """
from http import HTTPStatus from http import HTTPStatus
from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar from typing import BinaryIO, Generic, MutableMapping, Optional, Tuple, TypeVar
import attr import attr
class Unset: class Unset:
def __bool__(self) -> Literal[False]: def __bool__(self) -> bool:
return False return False

View File

@ -7,7 +7,7 @@ long_description = (here / "README.md").read_text(encoding="utf-8")
setup( setup(
name="PhotosAPI_Client", name="PhotosAPI_Client",
version="0.3.0", version="0.2.0",
description="A client library for accessing Photos API", description="A client library for accessing Photos API",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",