Answer the question
In order to leave comments, you need to log in
How to use API in python for parsing?
There is an open API, it gives access to updated information from the game about the exchange rate for gold. I am new to programming and would like to write a program in python that would help me find out every 2-3 minutes how much the price has increased or fallen relative to the average per day. Help good people. Here is the site itself with this API
Answer the question
In order to leave comments, you need to log in
There api is simple, like 2 kopecks.
Here is an example of how to get the gold price:
import requests
import json
url = 'https://www.albion-online-data.com/api/v2/stats/Gold'
response = requests.get(url)
json_data = json.loads(response.text)
for data in json_data:
price = data['price']
timestamp = data['timestamp']
print(f'Дата: {timestamp} - Цена: {price}')
Дата: 2021-01-09T21:00:00 - Цена: 3007
Дата: 2021-01-09T22:00:00 - Цена: 3006
Дата: 2021-01-09T23:00:00 - Цена: 3004
Дата: 2021-01-10T00:00:00 - Цена: 3003
Много много много строк
...
...
...
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question