asyncly 0.3.3__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- asyncly-0.3.4/.gitignore +164 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/PKG-INFO +14 -16
- asyncly-0.3.4/asyncly/srvmocker/constants.py +5 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/srvmocker/handlers.py +2 -1
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/srvmocker/models.py +3 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/srvmocker/service.py +12 -7
- {asyncly-0.3.3 → asyncly-0.3.4}/pyproject.toml +39 -35
- {asyncly-0.3.3 → asyncly-0.3.4}/README.rst +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/__init__.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/__init__.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/base.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/handlers/__init__.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/handlers/base.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/handlers/exceptions.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/handlers/json.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/handlers/msgspec.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/handlers/pydantic.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/client/timeout.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/py.typed +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/srvmocker/__init__.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/srvmocker/responses.py +0 -0
- {asyncly-0.3.3 → asyncly-0.3.4}/asyncly/srvmocker/serialization.py +0 -0
asyncly-0.3.4/.gitignore
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
junit.xml
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
103
|
+
#poetry.lock
|
|
104
|
+
|
|
105
|
+
# pdm
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
107
|
+
#pdm.lock
|
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
109
|
+
# in version control.
|
|
110
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
111
|
+
.pdm.toml
|
|
112
|
+
.pdm-python
|
|
113
|
+
.pdm-build/
|
|
114
|
+
|
|
115
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
116
|
+
__pypackages__/
|
|
117
|
+
|
|
118
|
+
# Celery stuff
|
|
119
|
+
celerybeat-schedule
|
|
120
|
+
celerybeat.pid
|
|
121
|
+
|
|
122
|
+
# SageMath parsed files
|
|
123
|
+
*.sage.py
|
|
124
|
+
|
|
125
|
+
# Environments
|
|
126
|
+
.env
|
|
127
|
+
.venv
|
|
128
|
+
env/
|
|
129
|
+
venv/
|
|
130
|
+
ENV/
|
|
131
|
+
env.bak/
|
|
132
|
+
venv.bak/
|
|
133
|
+
|
|
134
|
+
# Spyder project settings
|
|
135
|
+
.spyderproject
|
|
136
|
+
.spyproject
|
|
137
|
+
|
|
138
|
+
# Rope project settings
|
|
139
|
+
.ropeproject
|
|
140
|
+
|
|
141
|
+
# mkdocs documentation
|
|
142
|
+
/site
|
|
143
|
+
|
|
144
|
+
# mypy
|
|
145
|
+
.mypy_cache/
|
|
146
|
+
.dmypy.json
|
|
147
|
+
dmypy.json
|
|
148
|
+
|
|
149
|
+
# Pyre type checker
|
|
150
|
+
.pyre/
|
|
151
|
+
|
|
152
|
+
# pytype static type analyzer
|
|
153
|
+
.pytype/
|
|
154
|
+
|
|
155
|
+
# Cython debug symbols
|
|
156
|
+
cython_debug/
|
|
157
|
+
|
|
158
|
+
# PyCharm
|
|
159
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
160
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
161
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
162
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
163
|
+
.idea/
|
|
164
|
+
.vscode/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: asyncly
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Simple HTTP client and server for your integrations based on aiohttp
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Author: Sergey Natalenko
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
Project-URL: Homepage, https://github.com/andy-takker/asyncly
|
|
6
|
+
Project-URL: Source, https://github.com/andy-takker/asyncly
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/andy-takker/asyncly/issues
|
|
8
|
+
Author-email: Sergey Natalenko <sergey.natalenko@mail.ru>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: aiohttp,client,http
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Framework :: AsyncIO
|
|
13
13
|
Classifier: Framework :: Pytest
|
|
@@ -22,21 +22,19 @@ Classifier: Programming Language :: Python :: 3
|
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
24
24
|
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
26
25
|
Classifier: Topic :: Internet
|
|
27
26
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
28
27
|
Classifier: Topic :: Software Development
|
|
29
28
|
Classifier: Topic :: Software Development :: Libraries
|
|
30
29
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
30
|
+
Requires-Python: <4,>=3.10
|
|
31
|
+
Requires-Dist: aiohttp<4,>=3.9.5
|
|
31
32
|
Provides-Extra: msgspec
|
|
33
|
+
Requires-Dist: msgspec<0.19,>=0.18.6; extra == 'msgspec'
|
|
32
34
|
Provides-Extra: orjson
|
|
35
|
+
Requires-Dist: orjson<4,>=3.10.6; extra == 'orjson'
|
|
33
36
|
Provides-Extra: pydantic
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist: msgspec (>=0.18.6,<0.19.0) ; extra == "msgspec"
|
|
36
|
-
Requires-Dist: orjson (>=3.10.6,<4.0.0) ; extra == "orjson"
|
|
37
|
-
Requires-Dist: pydantic (>=2.8.2,<3.0.0) ; extra == "pydantic"
|
|
38
|
-
Project-URL: Bug Tracker, https://github.com/andy-takker/asyncly/issues
|
|
39
|
-
Project-URL: Source, https://github.com/andy-takker/asyncly
|
|
37
|
+
Requires-Dist: pydantic<3,>=2.8.2; extra == 'pydantic'
|
|
40
38
|
Description-Content-Type: text/x-rst
|
|
41
39
|
|
|
42
40
|
Asyncly
|
|
@@ -201,4 +199,4 @@ Now we can use them in tests. See full example in `examples/test_catfact_client.
|
|
|
201
199
|
.. _pydantic: https://github.com/pydantic/pydantic
|
|
202
200
|
|
|
203
201
|
.. _examples/catfact_client.py: https://github.com/andy-takker/asyncly/blob/master/examples/catfact_client.py
|
|
204
|
-
.. _examples/test_catfact_client.py: https://github.com/andy-takker/asyncly/blob/master/examples/test_catfact_client.py
|
|
202
|
+
.. _examples/test_catfact_client.py: https://github.com/andy-takker/asyncly/blob/master/examples/test_catfact_client.py
|
|
@@ -3,6 +3,7 @@ from collections.abc import Awaitable, Callable
|
|
|
3
3
|
from aiohttp.web_request import Request
|
|
4
4
|
from aiohttp.web_response import Response
|
|
5
5
|
|
|
6
|
+
from asyncly.srvmocker.constants import SERVICE_KEY
|
|
6
7
|
from asyncly.srvmocker.models import MockService, RequestHistory
|
|
7
8
|
|
|
8
9
|
|
|
@@ -12,7 +13,7 @@ def get_default_handler(handler_name: str) -> Callable[[Request], Awaitable[Resp
|
|
|
12
13
|
request=request,
|
|
13
14
|
body=await request.read(),
|
|
14
15
|
)
|
|
15
|
-
context: MockService = request.app[
|
|
16
|
+
context: MockService = request.app[SERVICE_KEY]
|
|
16
17
|
context.history.append(history)
|
|
17
18
|
context.history_map[handler_name].append(history)
|
|
18
19
|
handler = context.handlers[handler_name]
|
|
@@ -4,7 +4,9 @@ from contextlib import asynccontextmanager
|
|
|
4
4
|
|
|
5
5
|
from aiohttp.test_utils import TestServer
|
|
6
6
|
from aiohttp.web_app import Application
|
|
7
|
+
from yarl import URL
|
|
7
8
|
|
|
9
|
+
from asyncly.srvmocker.constants import SERVICE_KEY
|
|
8
10
|
from asyncly.srvmocker.handlers import get_default_handler
|
|
9
11
|
from asyncly.srvmocker.models import MockRoute, MockService
|
|
10
12
|
|
|
@@ -14,6 +16,13 @@ async def start_service(
|
|
|
14
16
|
routes: Iterable[MockRoute],
|
|
15
17
|
) -> AsyncGenerator[MockService, None]:
|
|
16
18
|
app = Application()
|
|
19
|
+
mock_service = MockService(
|
|
20
|
+
history=list(),
|
|
21
|
+
history_map=defaultdict(list),
|
|
22
|
+
url=URL(),
|
|
23
|
+
handlers=dict(),
|
|
24
|
+
)
|
|
25
|
+
app[SERVICE_KEY] = mock_service
|
|
17
26
|
server = TestServer(app)
|
|
18
27
|
for route in routes:
|
|
19
28
|
app.router.add_route(
|
|
@@ -22,13 +31,9 @@ async def start_service(
|
|
|
22
31
|
handler=get_default_handler(route.handler_name),
|
|
23
32
|
)
|
|
24
33
|
await server.start_server()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
url=server.make_url(""),
|
|
29
|
-
handlers=dict(),
|
|
30
|
-
)
|
|
31
|
-
app["service"] = mock_service
|
|
34
|
+
|
|
35
|
+
mock_service.set_url(server.make_url(""))
|
|
36
|
+
|
|
32
37
|
try:
|
|
33
38
|
yield mock_service
|
|
34
39
|
finally:
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
[
|
|
1
|
+
[project]
|
|
2
2
|
name = "asyncly"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.4"
|
|
4
4
|
description = "Simple HTTP client and server for your integrations based on aiohttp"
|
|
5
|
-
authors = ["Sergey Natalenko
|
|
6
|
-
|
|
7
|
-
homepage = "https://github.com/andy-takker/asyncly"
|
|
5
|
+
authors = [{ name = "Sergey Natalenko", email = "sergey.natalenko@mail.ru" }]
|
|
6
|
+
requires-python = ">=3.10, <4"
|
|
8
7
|
readme = "README.rst"
|
|
9
|
-
|
|
8
|
+
license = "MIT"
|
|
9
|
+
keywords = [
|
|
10
|
+
"aiohttp",
|
|
11
|
+
"http",
|
|
12
|
+
"client",
|
|
13
|
+
]
|
|
10
14
|
classifiers = [
|
|
11
15
|
"Development Status :: 4 - Beta",
|
|
12
16
|
"Framework :: AsyncIO",
|
|
@@ -28,39 +32,39 @@ classifiers = [
|
|
|
28
32
|
"Topic :: Software Development :: Libraries",
|
|
29
33
|
"Topic :: Software Development",
|
|
30
34
|
]
|
|
31
|
-
|
|
32
|
-
{ include = "asyncly" },
|
|
33
|
-
]
|
|
35
|
+
dependencies = ["aiohttp>=3.9.5,<4"]
|
|
34
36
|
|
|
35
|
-
[
|
|
36
|
-
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
msgspec = ["msgspec>=0.18.6,<0.19"]
|
|
39
|
+
pydantic = ["pydantic>=2.8.2,<3"]
|
|
40
|
+
orjson = ["orjson>=3.10.6,<4"]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://github.com/andy-takker/asyncly"
|
|
44
|
+
Source = "https://github.com/andy-takker/asyncly"
|
|
37
45
|
"Bug Tracker" = "https://github.com/andy-takker/asyncly/issues"
|
|
38
46
|
|
|
39
|
-
[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
[tool.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
pygments = "^2.18.0"
|
|
57
|
-
pytest = "^8.3.3"
|
|
58
|
-
pytest-asyncio = "^0.24.0"
|
|
59
|
-
pytest-cov = "^6.0.0"
|
|
47
|
+
[dependency-groups]
|
|
48
|
+
dev = [
|
|
49
|
+
"pre-commit>=3.7.1,<5.0.0",
|
|
50
|
+
"mypy>=1.10.1,<2",
|
|
51
|
+
"ruff>=0.5.2,<0.9.0",
|
|
52
|
+
"restructuredtext-lint>=1.4.0,<2",
|
|
53
|
+
"pygments>=2.18.0,<3",
|
|
54
|
+
"pytest>=8.3.3,<9",
|
|
55
|
+
"pytest-asyncio>=0.24.0,<0.25",
|
|
56
|
+
"pytest-cov>=6.0.0,<7",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[tool.hatch.build.targets.sdist]
|
|
60
|
+
include = ["asyncly"]
|
|
61
|
+
|
|
62
|
+
[tool.hatch.build.targets.wheel]
|
|
63
|
+
include = ["asyncly"]
|
|
60
64
|
|
|
61
65
|
[build-system]
|
|
62
|
-
requires = ["
|
|
63
|
-
build-backend = "
|
|
66
|
+
requires = ["hatchling"]
|
|
67
|
+
build-backend = "hatchling.build"
|
|
64
68
|
|
|
65
69
|
[tool.pytest.ini_options]
|
|
66
70
|
asyncio_mode = "auto"
|
|
@@ -134,4 +138,4 @@ module = [
|
|
|
134
138
|
"msgspec.*",
|
|
135
139
|
"orjson.*",
|
|
136
140
|
]
|
|
137
|
-
ignore_missing_imports = true
|
|
141
|
+
ignore_missing_imports = true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|