| 12345678910111213141516171819202122232425262728293031323334 |
- import requests
- import json
- class ClientDetection:
- def __init__(self, base_url):
- self.base_url = base_url
- def list_detect_list(self):
- response = requests.get(f'{self.base_url}/')
- return response.json()
- def add_live(self, data):
- headers = {'Content-Type': 'application/json'}
- response = requests.post(f'{self.base_url}/', data=json.dumps(data), headers=headers)
- return response.json()
- def main():
- # 使用示例
- client = ClientDetection('http://127.0.0.1:9081')
- print(client.list_detect_list())
- data = [
- {
- "str": "https://live.bilibili.com/14917277",
- },
- {
- "str": "https://live.bilibili.com/14917277",
- }
- ]
- print(client.add_live(data))
-
- if __name__ == "__main__":
- main()
|