http2py 0.1.30__tar.gz → 0.1.31__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.
Files changed (29) hide show
  1. {http2py-0.1.30 → http2py-0.1.31}/PKG-INFO +10 -2
  2. {http2py-0.1.30 → http2py-0.1.31}/http2py/authentication.py +1 -1
  3. {http2py-0.1.30 → http2py-0.1.31}/http2py/cli_maker.py +1 -1
  4. {http2py-0.1.30 → http2py-0.1.31}/http2py/example_cli.py +1 -1
  5. {http2py-0.1.30 → http2py-0.1.31}/http2py/py2request.py +11 -9
  6. {http2py-0.1.30 → http2py-0.1.31}/http2py/util.py +4 -8
  7. {http2py-0.1.30 → http2py-0.1.31}/http2py.egg-info/PKG-INFO +10 -2
  8. {http2py-0.1.30 → http2py-0.1.31}/setup.cfg +1 -1
  9. {http2py-0.1.30 → http2py-0.1.31}/LICENSE +0 -0
  10. {http2py-0.1.30 → http2py-0.1.31}/README.md +0 -0
  11. {http2py-0.1.30 → http2py-0.1.31}/http2py/__init__.py +0 -0
  12. {http2py-0.1.30 → http2py-0.1.31}/http2py/api_pkg_maker.py +0 -0
  13. {http2py-0.1.30 → http2py-0.1.31}/http2py/client.py +0 -0
  14. {http2py-0.1.30 → http2py-0.1.31}/http2py/constants.py +0 -0
  15. {http2py-0.1.30 → http2py-0.1.31}/http2py/decorators.py +0 -0
  16. {http2py-0.1.30 → http2py-0.1.31}/http2py/default_configs.py +0 -0
  17. {http2py-0.1.30 → http2py-0.1.31}/http2py/global_state.py +0 -0
  18. {http2py-0.1.30 → http2py-0.1.31}/http2py/http2py_cls.py +0 -0
  19. {http2py-0.1.30 → http2py-0.1.31}/http2py/testing_utils.py +0 -0
  20. {http2py-0.1.30 → http2py-0.1.31}/http2py/tests/__init__.py +0 -0
  21. {http2py-0.1.30 → http2py-0.1.31}/http2py/tests/api_pkg_maker_test.py +0 -0
  22. {http2py-0.1.30 → http2py-0.1.31}/http2py/tests/conftest.py +0 -0
  23. {http2py-0.1.30 → http2py-0.1.31}/http2py.egg-info/SOURCES.txt +0 -0
  24. {http2py-0.1.30 → http2py-0.1.31}/http2py.egg-info/dependency_links.txt +0 -0
  25. {http2py-0.1.30 → http2py-0.1.31}/http2py.egg-info/entry_points.txt +0 -0
  26. {http2py-0.1.30 → http2py-0.1.31}/http2py.egg-info/not-zip-safe +0 -0
  27. {http2py-0.1.30 → http2py-0.1.31}/http2py.egg-info/requires.txt +0 -0
  28. {http2py-0.1.30 → http2py-0.1.31}/http2py.egg-info/top_level.txt +0 -0
  29. {http2py-0.1.30 → http2py-0.1.31}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: http2py
3
- Version: 0.1.30
3
+ Version: 0.1.31
4
4
  Summary: Tools to create python binders to http web services.
5
5
  Home-page: https://github.com/i2mint/http2py
6
6
  License: Apache
@@ -8,6 +8,14 @@ Keywords: webservice,http,requests,API
8
8
  Platform: any
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
+ Requires-Dist: glom
12
+ Requires-Dist: i2
13
+ Requires-Dist: ju
14
+ Requires-Dist: requests
15
+ Requires-Dist: argh
16
+ Requires-Dist: PyYAML
17
+ Requires-Dist: importlib_resources
18
+ Dynamic: license-file
11
19
 
12
20
  [Documentation here](https://i2mint.github.io/http2py/)
13
21
 
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  import os
3
3
  from pathlib import Path
4
- from typing import Iterable
4
+ from collections.abc import Iterable
5
5
 
6
6
  DFLT_CONFIG_FILENAME = os.path.join(Path.home(), ".http2py", "credentials.json")
7
7
 
@@ -6,7 +6,7 @@ import json
6
6
  import os
7
7
  from pathlib import Path
8
8
  import requests
9
- from typing import Callable, Iterable
9
+ from collections.abc import Callable, Iterable
10
10
  import yaml
11
11
 
12
12
  from i2.io_trans import JSONAnnotAndDfltIoTrans
@@ -1,5 +1,5 @@
1
1
  import argh
2
- from typing import Iterable
2
+ from collections.abc import Iterable
3
3
 
4
4
  from http2py.cli_maker import mk_argparse_friendly
5
5
  from i2.io_trans import AnnotAndDfltIoTrans
@@ -66,7 +66,7 @@ with I2mintModuleNotFoundErrorNiceMessage():
66
66
  from i2.signatures import set_signature_of_func, KO
67
67
 
68
68
  DFLT_PORT = 5000
69
- DFLT_BASE_URL = "http://localhost:{port}".format(port=DFLT_PORT)
69
+ DFLT_BASE_URL = f"http://localhost:{DFLT_PORT}"
70
70
  DFLT_REQUEST_METHOD = "post"
71
71
  DFLT_REQUEST_KWARGS = imdict({"method": DFLT_REQUEST_METHOD, "url": ""})
72
72
 
@@ -227,7 +227,7 @@ def mk_request_function(
227
227
  if "url_template" in method_spec:
228
228
  url_template = method_spec["url_template"]
229
229
  # Check if the url template already has parameters, add them otherwise
230
- if query_arg_names and not re.search("^.*\?((.*=.*)(&?))+$", url_template):
230
+ if query_arg_names and not re.search(r"^.*\?((.*=.*)(&?))+$", url_template):
231
231
  url_arg_parts = [f"{x}={{{x}}}" for x in query_arg_names if x in kwargs]
232
232
  url_args = "&".join(url_arg_parts)
233
233
  if url_args:
@@ -316,7 +316,7 @@ DFLT_METHOD_FUNC_FROM_METHOD_SPEC = mk_request_function
316
316
  str_formatter = string.Formatter()
317
317
 
318
318
 
319
- class Py2Request(object):
319
+ class Py2Request:
320
320
  """Make a class that has methods that offer a python interface to web requests"""
321
321
 
322
322
  def __init__(
@@ -653,8 +653,9 @@ def mk_method_spec_from_openapi_method_spec(
653
653
 
654
654
  ##### Open api stuff TODO: To move ###########################################
655
655
  from inspect import Parameter, Signature
656
- from typing import Union, Callable, Iterable
657
- from typing import Mapping as MappingType
656
+ from typing import Union
657
+ from collections.abc import Callable, Iterable
658
+ from collections.abc import Mapping as MappingType
658
659
 
659
660
  PK = Parameter.POSITIONAL_OR_KEYWORD
660
661
 
@@ -755,7 +756,8 @@ def mk_request_func_from_openapi_spec(
755
756
  mk_request_function.from_openapi_spec = mk_request_func_from_openapi_spec
756
757
 
757
758
 
758
- from typing import Optional, Iterable, Dict, Tuple, Callable
759
+ from typing import Optional, Dict, Tuple
760
+ from collections.abc import Iterable, Callable
759
761
  from ju.oas import Routes
760
762
  from http2py.py2request import mk_request_func_from_openapi_spec
761
763
 
@@ -773,12 +775,12 @@ def default_path_to_func_name(method: str, uri: str) -> str:
773
775
 
774
776
  def openapi_to_py(
775
777
  openapi_spec: dict,
776
- paths: Optional[Iterable[Tuple[str, str]]] = None,
778
+ paths: Iterable[tuple[str, str]] | None = None,
777
779
  *,
778
780
  path_to_func_name: Callable[[str, str], str] = default_path_to_func_name,
779
- servers: Optional[list] = None,
781
+ servers: list | None = None,
780
782
  default_server_url: str = "http://localhost:8000",
781
- ) -> Dict[str, Callable]:
783
+ ) -> dict[str, Callable]:
782
784
  """
783
785
  Given an OpenAPI spec dict, returns a dict mapping function names to request functions.
784
786
  The `servers` argument overrides or provides a default for the OpenAPI servers field.
@@ -26,8 +26,7 @@ class ModuleNotFoundErrorNiceMessage:
26
26
 
27
27
  def __exit__(self, exc_type, exc_val, exc_tb):
28
28
  if exc_type is ModuleNotFoundError:
29
- raise ModuleNotFoundError(
30
- f"""
29
+ raise ModuleNotFoundError(f"""
31
30
  It seems you don't have requred `{exc_val.name}` package.
32
31
  Try installing it by running:
33
32
 
@@ -35,8 +34,7 @@ Try installing it by running:
35
34
 
36
35
  in your terminal.
37
36
  For more information: https://pypi.org/project/{exc_val.name}
38
- """
39
- )
37
+ """)
40
38
 
41
39
 
42
40
  class I2mintModuleNotFoundErrorNiceMessage:
@@ -45,13 +43,11 @@ class I2mintModuleNotFoundErrorNiceMessage:
45
43
 
46
44
  def __exit__(self, exc_type, exc_val, exc_tb):
47
45
  if exc_type is ModuleNotFoundError:
48
- raise ModuleNotFoundError(
49
- f"""
46
+ raise ModuleNotFoundError(f"""
50
47
  It seems you don't have requred `{exc_val.name}` package. Not sure if this is the problem, but you could try:
51
48
  git clone https://github.com/i2mint/{exc_val.name}
52
49
  in a place that your python path (i.e. PYTHONPATH environment variable).
53
- """
54
- )
50
+ """)
55
51
 
56
52
 
57
53
  def is_jsonable(x):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: http2py
3
- Version: 0.1.30
3
+ Version: 0.1.31
4
4
  Summary: Tools to create python binders to http web services.
5
5
  Home-page: https://github.com/i2mint/http2py
6
6
  License: Apache
@@ -8,6 +8,14 @@ Keywords: webservice,http,requests,API
8
8
  Platform: any
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
+ Requires-Dist: glom
12
+ Requires-Dist: i2
13
+ Requires-Dist: ju
14
+ Requires-Dist: requests
15
+ Requires-Dist: argh
16
+ Requires-Dist: PyYAML
17
+ Requires-Dist: importlib_resources
18
+ Dynamic: license-file
11
19
 
12
20
  [Documentation here](https://i2mint.github.io/http2py/)
13
21
 
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = http2py
3
- version = 0.1.30
3
+ version = 0.1.31
4
4
  url = https://github.com/i2mint/http2py
5
5
  root_url = https://github.com/i2mint
6
6
  platforms = any
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes