/
githubmirror
/
OpenAgents
Обзор
Документация
Войти
/
githubmirror
/
OpenAgents
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
real_agents/plugins_agent/plugins/twelve_data/paths/exchanges.py
23 строки
740 B
Tianbao Xie
Update plugins (#135)
28 май 2024, 08:59
Не верифицирован
28 май 2024, 08:59
fab2c1b
Код
Авторство
О чём код?
import requests def call_api(input_json, api_key): url = "https://twelve-data1.p.rapidapi.com/exchanges" headers = {"X-RapidAPI-Key": api_key, "X-RapidAPI-Host": "twelve-data1.p.rapidapi.com"} response = requests.get(url, headers=headers, params=input_json) if response.status_code == 200: if "format" in input_json: if input_json["format"]: if input_json["format"].lower() == "json": return response.json() else: return response.text else: return response.json() else: return response.json() else: return {"status_code": response.status_code, "text": response.text}