Skip to content

Commit 0615f19

Browse files
authored
extra - expose module (#312)
1 parent 98746f7 commit 0615f19

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

aiopenapi3/extra/cookies.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ def info(self) -> email.message.Message:
4343
def __init__(
4444
self, cookiejar: http.cookiejar.CookieJar = None, policy: Literal["jar", "securitySchemes"] = "jar"
4545
) -> None:
46+
"""
47+
48+
:param cookiejar: a cookiejar.CookieJar instance
49+
:param policy: There are two policies:
50+
51+
* securitySchemes - only cookies whose name is in the securitySchemes are used. To match authentication \
52+
requirements credentials are set via OpenAPI.authenticate(name=value)
53+
* jar - all cookies are used, basically like a browser would do. Cookies not mentioned in securitySchemes \
54+
are set besides OpenAPI.authenticate() to allow using them without adjusting the description document.
55+
"""
4656
self.cookiejar: http.cookiejar.CookieJar = cookiejar or http.cookiejar.CookieJar()
4757
self.policy: Literal["jar", "securitySchemes"] = policy
4858
self.schemes: dict[str, str] = dict()

docs/source/api.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ Cull & Reduce
378378
Reduce & Cull are Plugins limiting the models built to the minimum required to match the requirements of the supplied Operations
379379
Code below will eleminate all schemas not required to serve the operations identified by the pattern/string match and http methods associated.
380380

381+
.. currentmodule:: aiopenapi3.extra
382+
.. autoclass:: Reduce
383+
:members: __init__
384+
.. autoclass:: Cull
385+
381386
.. code:: python
382387
383388
api = OpenAPI.load_sync(
@@ -392,20 +397,20 @@ Code below will eleminate all schemas not required to serve the operations ident
392397
],
393398
)
394399
395-
.. currentmodule:: aiopenapi3.extra
396-
.. autoclass:: Reduce
397-
:members: __init__
398-
.. autoclass:: Cull
400+
401+
402+
.. inheritance-diagram:: aiopenapi3.plugin.Init aiopenapi3.plugin.Document aiopenapi3.extra.Cull aiopenapi3.extra.Reduce
403+
:top-classes: aiopenapi3.plugin.Plugin
404+
:parts: -2
399405

400406

401407
Cookies
402408
-------
403409

404410
This plugin deals with cookies from responses and adds in requests based on a policy.
405411

406-
There are two policies:
407-
* securitySchemes - only cookies whose name is in the securitySchemes are used. To match authentication requirements credentials are set via OpenAPI.authenticate(name=value)
408-
* jar - all cookies are used, basically like a browser would do. Cookies not mentioned in securitySchemes are set besides OpenAPI.authenticate() to allow using them without adjusting the description document.
412+
.. autoclass:: Cookies
413+
:members: __init__
409414

410415
.. code:: python
411416
@@ -416,4 +421,6 @@ There are two policies:
416421
],
417422
)
418423
419-
.. autoclass:: Cookies
424+
.. inheritance-diagram:: aiopenapi3.plugin.Plugin aiopenapi3.plugin.Init aiopenapi3.plugin.Message aiopenapi3.extra.cookies.Cookies
425+
:top-classes: aiopenapi3.plugin.Plugin
426+
:parts: -2

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ packages = [
6969
"aiopenapi3",
7070
"aiopenapi3.v20",
7171
"aiopenapi3.v30",
72-
"aiopenapi3.v31"
72+
"aiopenapi3.v31",
73+
"aiopenapi3.extra"
7374
]
7475

7576
[tool.setuptools.dynamic]

0 commit comments

Comments
 (0)