Improved method detection
This commit is contained in:
parent
ab0531cf05
commit
e769f27957
|
@ -6,7 +6,10 @@ from fastapi.encoders import jsonable_encoder
|
||||||
from . import tools
|
from . import tools
|
||||||
|
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI(
|
||||||
|
title='Clients',
|
||||||
|
summary='Provides various clients.'
|
||||||
|
)
|
||||||
|
|
||||||
origins = [
|
origins = [
|
||||||
"http://localhost.tiangolo.com",
|
"http://localhost.tiangolo.com",
|
||||||
|
@ -26,4 +29,4 @@ app.add_middleware(
|
||||||
for tool in tools.get_tools():
|
for tool in tools.get_tools():
|
||||||
component, method = tool.__name__.split('.')
|
component, method = tool.__name__.split('.')
|
||||||
path = f'/{component}/{method}'
|
path = f'/{component}/{method}'
|
||||||
app.get(path, response_model=None)(tool)
|
app.get(path, response_model=None,tags=[component])(tool)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import logging
|
import logging
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
import typing
|
||||||
|
|
||||||
import clients
|
import clients
|
||||||
import requests_cache
|
import requests_cache
|
||||||
|
@ -109,6 +110,8 @@ def wrap_all_methods_on_client(obj):
|
||||||
method = getattr(obj, field_name)
|
method = getattr(obj, field_name)
|
||||||
if not callable(method):
|
if not callable(method):
|
||||||
continue
|
continue
|
||||||
|
if not hasattr(method, '__name__'):
|
||||||
|
continue
|
||||||
if method.__doc__ is None:
|
if method.__doc__ is None:
|
||||||
continue
|
continue
|
||||||
yield wrap_method(obj.__class__, method)
|
yield wrap_method(obj.__class__, method)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user