#!/usr/bin/env python

import os
import requests
from argparse import ArgumentParser

parser = ArgumentParser(description='Get current weather information')
parser.add_argument('zip', help='zip/postal code to get the weather for')
parser.add_argument('--country', default='us', help='Country zip/postal belongs to, default is "US"')

args = parser.parse_args()

url = "http://api.openweathermap.org/data/2.5/weather?zip=%s,%s&APPID=%s" %(args.zip, args.country, os.getenv("OWM_API_KEY"))

res = requets.get(url)
if res.status_code != 200:
    print("Error talking to weather provider: %s" % res.status_code)
    sys.exit(1)
print(res.json())

# OWM_API_KEY=YOURKEY weather 45891

3d0b77c2c446cb4cbbf43f2189c38f7af8fe1746
<mask token>

<mask token>
parser.add_argument('zip', help='zip/postal code to get the weather for')
parser.add_argument('--country', default='us', help=
    'Country zip/postal belongs to, default is "US"')
<mask token>
if res.status_code != 200:
    print('Error talking to weather provider: %s' % res.status_code)
    sys.exit(1)
print(res.json())

<mask token>
parser = ArgumentParser(description='Get current weather information')
parser.add_argument('zip', help='zip/postal code to get the weather for')
parser.add_argument('--country', default='us', help=
    'Country zip/postal belongs to, default is "US"')
args = parser.parse_args()
url = 'http://api.openweathermap.org/data/2.5/weather?zip=%s,%s&APPID=%s' % (
    args.zip, args.country, os.getenv('OWM_API_KEY'))
res = requets.get(url)
if res.status_code != 200:
    print('Error talking to weather provider: %s' % res.status_code)
    sys.exit(1)
print(res.json())

import os
import requests
from argparse import ArgumentParser
parser = ArgumentParser(description='Get current weather information')
parser.add_argument('zip', help='zip/postal code to get the weather for')
parser.add_argument('--country', default='us', help=
    'Country zip/postal belongs to, default is "US"')
args = parser.parse_args()
url = 'http://api.openweathermap.org/data/2.5/weather?zip=%s,%s&APPID=%s' % (
    args.zip, args.country, os.getenv('OWM_API_KEY'))
res = requets.get(url)
if res.status_code != 200:
    print('Error talking to weather provider: %s' % res.status_code)
    sys.exit(1)
print(res.json())

#!/usr/bin/env python

import os
import requests
from argparse import ArgumentParser

parser = ArgumentParser(description='Get current weather information')
parser.add_argument('zip', help='zip/postal code to get the weather for')
parser.add_argument('--country', default='us', help='Country zip/postal belongs to, default is "US"')

args = parser.parse_args()

url = "http://api.openweathermap.org/data/2.5/weather?zip=%s,%s&APPID=%s" %(args.zip, args.country, os.getenv("OWM_API_KEY"))

res = requets.get(url)
if res.status_code != 200:
    print("Error talking to weather provider: %s" % res.status_code)
    sys.exit(1)
print(res.json())

# OWM_API_KEY=YOURKEY weather 45891
