Есть код
import requests
api_url = 'https://p2p.binance.com/bapi/c2c/v2/friendly/c2c/adv/search'
crypto_currency = 'BTC' # криптовалюта
fiat_currency = 'RUB' # валюта
params = {
'asset': crypto_currency,
'tradeType': 'BUY',
'publisherType': 'USER',
'currentPage': 1,
'pageSize': 1,
'payTypes': ['4'], # Способ оплаты: банковский перевод
'fiat': fiat_currency,
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
}
response = requests.get(api_url, params=params, headers=headers)
if response.status_code == 200:
data = response.json()
advs = data['data']['advertisements']
if len(advs) > 0:
price = advs[0]['price']
print(f'The current price of {crypto_currency}/{fiat_currency} on Binance P2P is {price}')
else:
print(f'No active advertisements found for {crypto_currency}/{fiat_currency} on Binance P2P')
else:
print(f'Failed to fetch the price of {crypto_currency}/{fiat_currency} on Binance P2P')
не могу понять что не работает и как это исправить