Facebook
From Lousy Zebra, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 48
  1. import requests
  2. import json
  3.  
  4. url = "https://community-open-weather-map.p.rapidapi.com/weather"
  5.  
  6. querystring = {"q":"Warsaw,pl","lat":"0","lon":"0","callback":"test","id":"2172797","lang":"null","units":""metric" or "imperial"","mode":"xml, html"}
  7.  
  8. headers = {
  9.     'x-rapidapi-key': "a89d3385a6msh89ae7d5ccfb8e0bp1d22e8jsn710cdceeb838",
  10.     'x-rapidapi-host': "community-open-weather-map.p.rapidapi.com"
  11.     }
  12.  
  13. response = requests.request("GET", url, headers=headers, params=querystring)
  14.  
  15. obj = response.text
  16. x = json.loads(obj)
  17. print(x)