import requests
import json

class Weather(object):
    def __init__(self):
        self.weather_address = "http://127.0.0.1:8000/api/weather/"


    def get_weather(self,location):
        #TODO:ADD CASE IF NO WEATHER INFO WAS GIVIN BACK
        r = requests.get(self.weather_address+location)
        weather_data = r.json()
        if weather_data.get("temperature",None)!= None:
            temperature = str(weather_data.get("temperature").get("current"))
        else:
            temperature = "temperature_unknown"

        if weather_data.get("weather",None)!= None:
            weather_description = weather_data.get("weather").get("description")
        else:
            weather_description = "Weather unknown"
        return temperature,weather_description

ba422d8d8c2c5a0da863c737e9824e6cb31c7040
<mask token>


class Weather(object):
    <mask token>
    <mask token>

<mask token>


class Weather(object):
    <mask token>

    def get_weather(self, location):
        r = requests.get(self.weather_address + location)
        weather_data = r.json()
        if weather_data.get('temperature', None) != None:
            temperature = str(weather_data.get('temperature').get('current'))
        else:
            temperature = 'temperature_unknown'
        if weather_data.get('weather', None) != None:
            weather_description = weather_data.get('weather').get('description'
                )
        else:
            weather_description = 'Weather unknown'
        return temperature, weather_description

<mask token>


class Weather(object):

    def __init__(self):
        self.weather_address = 'http://127.0.0.1:8000/api/weather/'

    def get_weather(self, location):
        r = requests.get(self.weather_address + location)
        weather_data = r.json()
        if weather_data.get('temperature', None) != None:
            temperature = str(weather_data.get('temperature').get('current'))
        else:
            temperature = 'temperature_unknown'
        if weather_data.get('weather', None) != None:
            weather_description = weather_data.get('weather').get('description'
                )
        else:
            weather_description = 'Weather unknown'
        return temperature, weather_description

import requests
import json


class Weather(object):

    def __init__(self):
        self.weather_address = 'http://127.0.0.1:8000/api/weather/'

    def get_weather(self, location):
        r = requests.get(self.weather_address + location)
        weather_data = r.json()
        if weather_data.get('temperature', None) != None:
            temperature = str(weather_data.get('temperature').get('current'))
        else:
            temperature = 'temperature_unknown'
        if weather_data.get('weather', None) != None:
            weather_description = weather_data.get('weather').get('description'
                )
        else:
            weather_description = 'Weather unknown'
        return temperature, weather_description

import requests
import json

class Weather(object):
    def __init__(self):
        self.weather_address = "http://127.0.0.1:8000/api/weather/"


    def get_weather(self,location):
        #TODO:ADD CASE IF NO WEATHER INFO WAS GIVIN BACK
        r = requests.get(self.weather_address+location)
        weather_data = r.json()
        if weather_data.get("temperature",None)!= None:
            temperature = str(weather_data.get("temperature").get("current"))
        else:
            temperature = "temperature_unknown"

        if weather_data.get("weather",None)!= None:
            weather_description = weather_data.get("weather").get("description")
        else:
            weather_description = "Weather unknown"
        return temperature,weather_description
