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
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
app = FastAPI(
|
||||
title='Clients',
|
||||
summary='Provides various clients.'
|
||||
)
|
||||
|
||||
origins = [
|
||||
"http://localhost.tiangolo.com",
|
||||
|
@ -26,4 +29,4 @@ app.add_middleware(
|
|||
for tool in tools.get_tools():
|
||||
component, method = tool.__name__.split('.')
|
||||
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 logging
|
||||
from decimal import Decimal
|
||||
import typing
|
||||
|
||||
import clients
|
||||
import requests_cache
|
||||
|
@ -109,6 +110,8 @@ def wrap_all_methods_on_client(obj):
|
|||
method = getattr(obj, field_name)
|
||||
if not callable(method):
|
||||
continue
|
||||
if not hasattr(method, '__name__'):
|
||||
continue
|
||||
if method.__doc__ is None:
|
||||
continue
|
||||
yield wrap_method(obj.__class__, method)
|
||||
|
|
Loading…
Reference in New Issue
Block a user