httpbinx 1.5.1__py3-none-any.whl → 1.6.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
httpbinx/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.1
1
+ 1.6.0
@@ -39,7 +39,12 @@ async def decode_base64(
39
39
  value: str = Path(
40
40
  ...,
41
41
  title='base64-encoded string',
42
- example=AWESOME_BASE64ENCODED
42
+ # examples=[AWESOME_BASE64ENCODED],
43
+ openapi_examples={
44
+ 'awesome': {
45
+ 'summary': 'A awesome base64 string',
46
+ 'value': AWESOME_BASE64ENCODED
47
+ }}
43
48
  )
44
49
  ):
45
50
  encoded: bytes = value.encode('utf-8')
@@ -7,12 +7,12 @@ from starlette.responses import Response
7
7
  from httpbinx.helpers import status_code_response
8
8
  from httpbinx.helpers import weighted_choice
9
9
 
10
- router = APIRouter(tags=['Status Codes'])
10
+ router = APIRouter(tags=['Status codes'])
11
11
 
12
12
 
13
13
  @router.api_route(
14
14
  '/status/{codes}',
15
- methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'TRACE'],
15
+ methods=['GET'],
16
16
  summary='Return status code or random status code '
17
17
  'if more than one are given',
18
18
  response_description='Response corresponding to different HTTP status codes.'
@@ -22,7 +22,10 @@ async def status_code(
22
22
  codes: str = Path(
23
23
  ...,
24
24
  description='a status code or status codes with weight',
25
- example='200:3,400:1'
25
+ # examples=['200:3,400:1'],
26
+ openapi_examples={
27
+ 'sample': {'value': '200:3,400:1'}
28
+ }
26
29
  ),
27
30
  ) -> Response:
28
31
  invalid_status_code_desc = 'Invalid status code'
httpbinx/schemas.py CHANGED
@@ -1,14 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
+ import json
2
3
  from enum import Enum
3
4
  from functools import lru_cache
4
- import json
5
- from typing import AnyStr
6
- from typing import Dict
7
- from typing import Union
5
+ from typing import AnyStr, Dict, Union
8
6
 
9
- from pydantic import AnyHttpUrl
10
- from pydantic import BaseModel
11
- from pydantic import Field
7
+ from pydantic import AnyHttpUrl, BaseModel, Field
12
8
  from starlette.requests import Request
13
9
 
14
10
 
@@ -103,7 +99,10 @@ class RequestAttrs:
103
99
  @property
104
100
  def client_host(self) -> str:
105
101
  """request client host."""
106
- return self.request.client.host
102
+ client = self.request.client
103
+ if client is None:
104
+ return ''
105
+ return client.host
107
106
 
108
107
  @property
109
108
  async def data(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: httpbinx
3
- Version: 1.5.1
3
+ Version: 1.6.0
4
4
  Summary: HTTP Request & Response Service, written in Python + FastAPI.
5
5
  Home-page: https://github.com/imleowoo/httpbinx
6
6
  Author: Leo
@@ -12,12 +12,12 @@ Project-URL: Source, https://github.com/imleowoo/httpbinx
12
12
  Classifier: Programming Language :: Python
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
14
  Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.7
16
15
  Classifier: Programming Language :: Python :: 3.8
17
16
  Classifier: Programming Language :: Python :: 3.9
18
17
  Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
- Requires-Python: >=3.7
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.8
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
23
  Requires-Dist: fastapi
@@ -1,22 +1,22 @@
1
- httpbinx/VERSION,sha256=3-fXGz9Cjrc-2FP4_e1l4pholuIdafRevwa7YjtFDhQ,6
1
+ httpbinx/VERSION,sha256=yx2aMLxKuKOX85t9eGu4KsoLgWB37vw118giAX119qU,6
2
2
  httpbinx/__init__.py,sha256=hPPEFgOAqXD22JamTP9uGK42qngDmwmM35RVg2varDA,289
3
3
  httpbinx/constants.py,sha256=aJay1yI313fLxfFXgBPLE6p_UABlHq1KGEcdO7Nf2FQ,906
4
4
  httpbinx/helpers.py,sha256=-fJyFbToQ0QwRY5UZ3Bkx7Ui_nj_bk8Wd4qKRtYGIsg,3787
5
5
  httpbinx/main.py,sha256=idQXiobak79bY1Stm2G2aAAQO6LmrAB5dZbflJ8u5ew,837
6
6
  httpbinx/meta.py,sha256=gqWHplgb0SiUFVmZ8-gbOrZA468R-y9uDCQjqeQSHN8,1185
7
- httpbinx/schemas.py,sha256=8RAV3xZkVOPgvWL5veyBOT5JSvS404lTdeN_Wu5phIs,4032
7
+ httpbinx/schemas.py,sha256=QxBcsd4Go1azLPWF8E_uLyUVcnzI7Rwny-woDPvAzp0,4029
8
8
  httpbinx/utils.py,sha256=kMVB5ORarUJj6MdySbb8utCbgyM2WbitSmiDYBAFnSs,464
9
9
  httpbinx/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  httpbinx/routers/__init__.py,sha256=xwbZGA3-sV07HCPAly8o5uUJGbdKH3pBHUakXEjvRK4,1409
11
11
  httpbinx/routers/anything.py,sha256=KtNMHx4aEGQS6fc21YdHszorm1_gPIfpYuCkImgQFCA,564
12
12
  httpbinx/routers/auth.py,sha256=nGZA1aQtrS2B74vM2NORHSWMXf5q25JC2J63hAO2_Us,717
13
13
  httpbinx/routers/cookies.py,sha256=TB3ADXXg0kgZX5nE1QlrVk1mKXjdFAMJ7iMfd8kfMBc,2341
14
- httpbinx/routers/dynamicdata.py,sha256=sZYX9L3pBXRlPZgs5MkDiltqom9-3OtnkknUymHrQDc,6596
14
+ httpbinx/routers/dynamicdata.py,sha256=Cas2JWkQnCaKNuE0Vw84h4YKcfl8PlsvAy6kYdvw_f4,6790
15
15
  httpbinx/routers/httpmethods.py,sha256=X9YPADi9D6FQnybJWyXc5BTDErgFZ5Xa4OIy7OKAifQ,1531
16
16
  httpbinx/routers/images.py,sha256=JBZ08Ez2gmXiGfA-jNXN3SaQzvQMmFkRrX9E0f_k3fk,2261
17
17
  httpbinx/routers/redirects.py,sha256=aEWL1VcEaqzAz-nr7fPgKw1_iA_JCtbzS6syB0Urs4E,3023
18
18
  httpbinx/routers/responseformats.py,sha256=sqRLzSFjUmN5B9urbMVR7X_AydqvuT1pvHGIXyzhedw,4996
19
- httpbinx/routers/statuscodes.py,sha256=gLyX_YNj2FKld_nzvidVjLMyRqDXMDepSyp68XG7ThA,1681
19
+ httpbinx/routers/statuscodes.py,sha256=Iu0dcGsXLv34otIrH6WrWm_vOHt-9zAnblojM-d_qV0,1740
20
20
  httpbinx/routers/inspection/__init__.py,sha256=OMPci9p6uK9L6uFKQKbIqOn-r5MndCWSqlw-bJsUE3E,166
21
21
  httpbinx/routers/inspection/request.py,sha256=8b5HEuX2ED-YjMB5S0h-2xZDAmyo4ru9RX2S1tCwaqs,1224
22
22
  httpbinx/routers/inspection/response.py,sha256=yJ46k1O80WO8hq4gF09KHrsQJeP7Cn0aj6AAphfyyAY,2863
@@ -32,8 +32,8 @@ httpbinx/templates/index.html,sha256=9--gnqsRkQjSqiZr-Ljn2gr_b3Ddr8Zx91lFk7o91Vw
32
32
  httpbinx/templates/moby.html,sha256=4lCnl11TgB7Yw1JxeAoVodo2qKU4MyfLcG3qJSs0DUg,3742
33
33
  httpbinx/templates/sample.xml,sha256=UcHibo5ClF0e3nhCbgLlQmUw33Rwnd5Rr6IYIqNQumg,522
34
34
  httpbinx/templates/trackingscripts.html,sha256=M5P33NOYlYaoOEDPzaJqKWPJCPxSx2zZsYWR9DT_D5E,583
35
- httpbinx-1.5.1.dist-info/LICENSE,sha256=t6oZPzEcm1CsBu9sB_8JYTc5rSOUhyQUee5qvAg4o-A,1060
36
- httpbinx-1.5.1.dist-info/METADATA,sha256=hzAPR-YXF4Yuq-8eIsYPwov_TW5PjB-L76OXkhdhH8E,2309
37
- httpbinx-1.5.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
38
- httpbinx-1.5.1.dist-info/top_level.txt,sha256=zg7vMSUefYOTEUftRjOOmG3W5kfueHlHWG7zr46q1jI,9
39
- httpbinx-1.5.1.dist-info/RECORD,,
35
+ httpbinx-1.6.0.dist-info/LICENSE,sha256=t6oZPzEcm1CsBu9sB_8JYTc5rSOUhyQUee5qvAg4o-A,1060
36
+ httpbinx-1.6.0.dist-info/METADATA,sha256=ULkdGc20-rFItJKayo4H-PvntGEqZJS4NngOcEz2cfk,2310
37
+ httpbinx-1.6.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
38
+ httpbinx-1.6.0.dist-info/top_level.txt,sha256=zg7vMSUefYOTEUftRjOOmG3W5kfueHlHWG7zr46q1jI,9
39
+ httpbinx-1.6.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5