mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 08:11:38 +00:00
Initial commit
This commit is contained in:
16
apiclient.py
Normal file
16
apiclient.py
Normal file
@ -0,0 +1,16 @@
|
||||
import requests
|
||||
|
||||
|
||||
class ApiClient:
|
||||
def __init__(self, base_url):
|
||||
self.url = base_url
|
||||
|
||||
def __getattr__(self, item):
|
||||
newclient = ApiClient(self.url + '/' + item)
|
||||
return newclient
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return requests.get(self.url, params=kwargs)
|
||||
|
||||
|
||||
client = ApiClient('http://127.0.0.1:5000/openqq')
|
Reference in New Issue
Block a user