parameters: (self, inLat, inLong, time=None, units="auto", lazy=False,
                        callback=None)
docstring: This function builds the request url and loads some or all of the
              needed json depending on lazy is True
  
              inLat:  The latitude of the forecast
              inLong: The longitude of the forecast
              time:   A datetime.datetime object representing the desired time of
                      the forecast
              units:  A string of the preferred units of measurement, "auto" id
                      default. also us,ca,uk,si is available
              lazy:   Defaults to true.  The function will only request the json
                      data as it is needed. Results in more requests, but
                      probably a faster response time (I haven't checked)
docstring_summary: This function builds the request url and loads some or all of the
              needed json depending on lazy is True
docstring_tokens: This function builds the request url and loads some or all of the needed json depending on lazy is True
function: def load_forecast(self, inLat, inLong, time=None, units="auto", lazy=False,
                        callback=None):
  
          """
              This function builds the request url and loads some or all of the
              needed json depending on lazy is True
  
              inLat:  The latitude of the forecast
              inLong: The longitude of the forecast
              time:   A datetime.datetime object representing the desired time of
                      the forecast
              units:  A string of the preferred units of measurement, "auto" id
                      default. also us,ca,uk,si is available
              lazy:   Defaults to true.  The function will only request the json
                      data as it is needed. Results in more requests, but
                      probably a faster response time (I haven't checked)
          """
  
          self.lat = inLat
          self.long = inLong
          self.time = time
  
          if self.time is None:
              self.url = 'https://api.forecast.io/forecast/%s/%s,%s' \
                         '?units=%s' % (self.key, self.lat, self.long, units,)
          else:
              url_time = str(int(Time.mktime(self.time.timetuple())))
              self.url = 'https://api.forecast.io/forecast/%s/%s,%s,%s' \
                         '?units=%s' % (self.key, self.lat, self.long, url_time,
                                        units,)
  
          if lazy is True:
              baseURL = "%s&exclude=%s" % (self.url,
                                           'minutely,currently,hourly,'
                                           'daily,alerts,flags')
          else:
              baseURL = self.url
  
          if callback is None:
              try:
                  self.json = json.load(urllib2.urlopen(baseURL))
                  return {'success': True, 'url': baseURL, 'response': self.json}
              except urllib2.HTTPError, e:
                  return {'success': False, 'url': baseURL,
                          'response': '%s, %s' % (e.code, e.reason,)}
              except urllib2.URLError, e:
                  return {'success': False, 'url': baseURL,
                          'response': '%s, %s' % (e.code, e.reason,)}
              except Exception, e:
                  return {'success': False, 'url': baseURL, 'response': e}
  
          else:
              thr = threading.Thread(target=self.load_async, args=(baseURL,),
                                     kwargs={'callback': callback})
              thr.start()
function_tokens: def load_forecast ( self , inLat , inLong , time = None , units = "auto" , lazy = False , callback = None ) : self . lat = inLat self . long = inLong self . time = time if self . time is None : self . url = 'https://api.forecast.io/forecast/%s/%s,%s' '?units=%s' % ( self . key , self . lat , self . long , units , ) else : url_time = str ( int ( Time . mktime ( self . time . timetuple ( ) ) ) ) self . url = 'https://api.forecast.io/forecast/%s/%s,%s,%s' '?units=%s' % ( self . key , self . lat , self . long , url_time , units , ) if lazy is True : baseURL = "%s&exclude=%s" % ( self . url , 'minutely,currently,hourly,' 'daily,alerts,flags' ) else : baseURL = self . url if callback is None : try : self . json = json . load ( urllib2 . urlopen ( baseURL ) ) return { 'success' : True , 'url' : baseURL , 'response' : self . json } except urllib2 . HTTPError , e : return { 'success' : False , 'url' : baseURL , 'response' : '%s, %s' % ( e . code , e . reason , ) } except urllib2 . URLError , e : return { 'success' : False , 'url' : baseURL , 'response' : '%s, %s' % ( e . code , e . reason , ) } except Exception , e : return { 'success' : False , 'url' : baseURL , 'response' : e } else : thr = threading . Thread ( target = self . load_async , args = ( baseURL , ) , kwargs = { 'callback' : callback } ) thr . start ( )