Guest User

Untitled

a guest
Oct 23rd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import pyowm
  2. import psycopg2
  3. conn = psycopg2.connect(database="dev",
  4. user='irinarozalio',
  5. password='Unix11',
  6. host = '10.128.0.2')
  7.  
  8. cur = conn.cursor()
  9. cur.execute('select now()')
  10. output = cur.fetchone()
  11. print(output)
  12. quit()
  13.  
  14. owm = pyowm.OWM('173c264e22588743e364954a88b4de49') # You MUST provide a valid API key
  15.  
  16. # Have a pro subscription? Then use:
  17. # owm = pyowm.OWM(API_key='your-API-key', subscription_type='pro')
  18.  
  19. # Search for current weather in London (Great Britain)
  20. observation = owm.weather_at_place('London,GB')
  21. w = observation.get_weather()
  22. print(w) # <Weather - reference time=2013-12-18 09:20,
  23. # status=Clouds>
  24.  
  25. # Weather details
  26. print(w.get_wind()) # {'speed': 4.6, 'deg': 330}
  27. print(w.get_humidity()) # 87
  28. print(w.get_temperature('celsius')) # {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0}
  29.  
  30. # Search current weather observations in the surroundings of
  31. # lat=22.57W, lon=43.12S (Rio de Janeiro, BR)
  32. #observation_list = owm.weather_around_coords(-22.57, -43.12)
  33. #
Add Comment
Please, Sign In to add comment