Changes between Version 1 and Version 2 of en/ProgrammingRobotsCourse/GettingWwwInfo
- Timestamp:
- Oct 28, 2019, 4:13:53 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
en/ProgrammingRobotsCourse/GettingWwwInfo
v1 v2 3 3 == How to get info from web? 4 4 5 === Use API 6 If API exists, you can usually use JSON data after send the right parameters. Example to get weather data. 5 7 6 * 8 {{{#!python 9 import requests 10 url = "http://api.openweathermap.org/data/2.5/weather" 11 12 params = {'q': 'Brno', 13 'units': 'metric', 14 'lang': 'cz'} 15 16 r = requests.get(url=url, params=params) 17 data = r.json() 18 19 print(data['main']['temp']) 20 }}}