Answer the question
In order to leave comments, you need to log in
How to pull information from api?
I was looking for a solution to my problem on the Internet, I found a link to habr Why does it not display by id with Beautiful Soup?
There, user Ranc58 gave an example, and wrote: "..As a result, you don't need to parse anything, just pull information from the API"
Question: how to pull information from the API?
There is such a url https://minfin.com.ua/api/currency/ratelist/?curre...
You need to extract information about the USD rate from it (by the sell parameter), so that you can execute print('smth') and get dollar exchange rate in one line
Answer the question
In order to leave comments, you need to log in
There is a regular json.
Example:
import json
import requests
response = requests.get('https://minfin.com.ua/api/currency/ratelist/?currency1=usd¤cy2=uah&converter_type=midbank')
json_data = json.loads(response.text)
sell = json_data['data']['rates']['sell']
for key in sell:
print(key, '->', sell[key])
USD -> 27.5000
UAH -> 1
RUB -> 0.3600
EUR -> 32.0000
PLN -> 6.8000
GBP -> 34.0000
CZK -> 1.0000
CNY -> 3.0000
BYN -> 12.5000
KZT -> 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question