Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
538 B
1
Indexable
Never
def get_data_from_json(url):
    response = requests.get(url)
    if response.status_code == 200:
        json_data = response.json()
        if 'data' in json_data:
            data = json_data['data']
            print("Data:", data)
        else:
            print("No 'data' key found in JSON response")
    else:
        print("Error:", response.status_code)

# Вызов функции для ссылки https://contract.mexc.com/api/v1/contract/ping
url = "https://contract.mexc.com/api/v1/contract/ping"
get_data_from_json(url)