diff --git a/README.md b/README.md index 86da4b9..4a8ac3e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Using `@decorator` to easily request an HTTP Client
This framework based on [aiohttp](https://github.com/aio-libs/aiohttp)'s http client framework.
-Use Union Type to describe the elements required in an HTTP request. +Use Annotated Type to describe the elements required in an HTTP request. ## Installation @@ -25,7 +25,7 @@ An example is the API provided by the [BUS API](https://github.com/gunyu1019/tra import asyncio import aiohttp from ahttp_client import request, Session, Query -from typing import Any +from typing import Annotated, Any loop = asyncio.get_event_loop() @@ -38,7 +38,7 @@ class MetroAPI(Session): async def station_search_with_query( self, response: aiohttp.ClientResponse, - name: Query | str + name: Annotated[str, Query] ) -> dict[str, Any]: return await response.json() diff --git a/ahttp_client/__init__.py b/ahttp_client/__init__.py index ff3cfb6..ebae6fa 100644 --- a/ahttp_client/__init__.py +++ b/ahttp_client/__init__.py @@ -36,7 +36,7 @@ __author__ = "gunyu1019" __license__ = "MIT" __copyright__ = "Copyright 2023-present gunyu1019" -__version__ = "1.0.0" # version_info.to_string() +__version__ = "1.0.1" # version_info.to_string() class VersionInfo(NamedTuple): @@ -53,4 +53,4 @@ def to_string(self) -> str: return _version_info -version_info: VersionInfo = VersionInfo(major=1, minor=0, micro=0, release_level=None, serial=0) +version_info: VersionInfo = VersionInfo(major=1, minor=0, micro=1, release_level=None, serial=0) diff --git a/ahttp_client/extension.py b/ahttp_client/extension.py index 6d5db3d..003f68e 100644 --- a/ahttp_client/extension.py +++ b/ahttp_client/extension.py @@ -1,7 +1,7 @@ from __future__ import annotations import inspect -from collections.abc import Iterable +from collections.abc import Sequence from types import GenericAlias from typing import overload, TYPE_CHECKING, TypeVar @@ -139,7 +139,7 @@ def _parsing_json_to_model( from_attributes: Optional[bool] = None, context: Optional[dict[str, Any]] = None, ) -> BaseModelT: - if isinstance(data, Iterable): + if isinstance(data, Sequence): validated_data = [ model.model_validate( obj=x,