I am new to python. Due to I need your help.
I have excel file having some numbers and API of a website where I can download numbers and it returns some info about each number. I 've searched and found that library as requests can do.
import requests
import pandas as pd
df=pd.read_excel('numbers.xlsx')
for number in df['num']:
r = requests.get('https://example.com/datas=%s'%number')
print (r.text)
However, I don't know how to get data from API response
Output from API response is like that:
age: 0
lat: 70.0000
lon: 70.0000
url: example.com
I wanna only output of age. However, I guess it's not dictionary and not JSON, because I print:
1) print (r['age'])
- TypeError: 'Response' object is not subscriptable
Then I did this:
2)
res = r.json()
print(res["age"])
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
How can I extract only age value?
Also how is possible to increase speed of the script, because going through 20.000 numbers takes few hours.((