openapi-httpx-client 0.2.0__tar.gz → 0.3.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openapi-httpx-client
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A Python client for OpenAPI specifications using httpx
5
5
  Home-page: https://github.com/lloydzhou/openapiclient
6
6
  Author: lloydzhou
@@ -36,6 +36,12 @@ async def main():
36
36
  try:
37
37
  # Initialize and get the dynamic client
38
38
  client = await api.init()
39
+ print("client", client, dir(client))
40
+
41
+ print("client.operations", client.operations)
42
+ print("client.paths", client.paths)
43
+ print("client.functions", client.functions)
44
+ print("client.tools", client.tools) # get function call tools
39
45
 
40
46
  # Call an operation using the generated method
41
47
  response = await client.getPetById(petId=1)
@@ -43,6 +49,11 @@ async def main():
43
49
  # Print the response
44
50
  print(f"Status code: {response['status']}")
45
51
  print(f"Pet data: {response['data']}")
52
+
53
+ # Call an operation using the generated method
54
+ response = await client('getPetById', petId=1)
55
+ print(f"Status code: {response['status']}")
56
+ print(f"Pet data: {response['data']}")
46
57
  finally:
47
58
  # Close the HTTP session
48
59
  await api.close()
@@ -21,6 +21,12 @@ async def main():
21
21
  try:
22
22
  # Initialize and get the dynamic client
23
23
  client = await api.init()
24
+ print("client", client, dir(client))
25
+
26
+ print("client.operations", client.operations)
27
+ print("client.paths", client.paths)
28
+ print("client.functions", client.functions)
29
+ print("client.tools", client.tools) # get function call tools
24
30
 
25
31
  # Call an operation using the generated method
26
32
  response = await client.getPetById(petId=1)
@@ -28,6 +34,11 @@ async def main():
28
34
  # Print the response
29
35
  print(f"Status code: {response['status']}")
30
36
  print(f"Pet data: {response['data']}")
37
+
38
+ # Call an operation using the generated method
39
+ response = await client('getPetById', petId=1)
40
+ print(f"Status code: {response['status']}")
41
+ print(f"Pet data: {response['data']}")
31
42
  finally:
32
43
  # Close the HTTP session
33
44
  await api.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openapi-httpx-client
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: A Python client for OpenAPI specifications using httpx
5
5
  Home-page: https://github.com/lloydzhou/openapiclient
6
6
  Author: lloydzhou
@@ -36,6 +36,12 @@ async def main():
36
36
  try:
37
37
  # Initialize and get the dynamic client
38
38
  client = await api.init()
39
+ print("client", client, dir(client))
40
+
41
+ print("client.operations", client.operations)
42
+ print("client.paths", client.paths)
43
+ print("client.functions", client.functions)
44
+ print("client.tools", client.tools) # get function call tools
39
45
 
40
46
  # Call an operation using the generated method
41
47
  response = await client.getPetById(petId=1)
@@ -43,6 +49,11 @@ async def main():
43
49
  # Print the response
44
50
  print(f"Status code: {response['status']}")
45
51
  print(f"Pet data: {response['data']}")
52
+
53
+ # Call an operation using the generated method
54
+ response = await client('getPetById', petId=1)
55
+ print(f"Status code: {response['status']}")
56
+ print(f"Pet data: {response['data']}")
46
57
  finally:
47
58
  # Close the HTTP session
48
59
  await api.close()
@@ -3,8 +3,6 @@ import json
3
3
  import os.path
4
4
  from urllib.parse import urljoin, urlparse
5
5
  import yaml
6
- import types
7
- import functools
8
6
  from nanoid import generate as nanoid_generate
9
7
 
10
8
  # Create a base class for DynamicClient
@@ -34,7 +32,7 @@ class DynamicClientBase:
34
32
  if not method or not callable(method):
35
33
  raise AttributeError(f"'{self.__class__.__name__}' has no callable method '{method_name}'")
36
34
 
37
- return functools.partial(method, *args, **kwargs)
35
+ return method(*args, **kwargs)
38
36
 
39
37
 
40
38
  # Create the main OpenAPIClient class
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name="openapi-httpx-client",
8
- version="0.2.0",
8
+ version="0.3.0",
9
9
  author="lloydzhou",
10
10
  author_email="lloydzhou@qq.com",
11
11
  description="A Python client for OpenAPI specifications using httpx",