<commit_before>"""
Implementation of the OpenWeatherMap API.
"""
__author__ = '<EMAIL> (<NAME>)'

OPEN_WEATHER_MAP_URL = 'api.openweathermap.org/data/2.5'
WEATHER_URL = '/weather'

import requests

import log

logging = log.Log(__name__)

def GetCurrentExternalTemperature(appid, latitude, longitude):
  params = {
      'APPID': appid,
      'units': 'imperial',
      'lat': latitude,
      'lon': longitude
  }
  response = requests.put(
      OPEN_WEATHER_MAP_URL + WEATHER_URL,
      params=params)
  if response.status_code != 200:
    logging.exception('Unexpected response: ', response.text)
  response_parsed = response.json()
  if 'main' not in response_parsed or 'temp' not in response_parsed['main']:
    logging.exception('Expected fields not in response: ', response.text)
  return response_parsed['main']['temp']<commit_msg>Fix URL scheme for OpenWeatherMap.<commit_after>"""
Implementation of the OpenWeatherMap API.
"""
__author__ = '<EMAIL> (<NAME>)'

OPEN_WEATHER_MAP_URL = 'http://api.openweathermap.org/data/2.5'
WEATHER_URL = '/weather'

import requests

import log

logging = log.Log(__name__)

def GetCurrentExternalTemperature(appid, latitude, longitude):
  params = {
      'APPID': appid,
      'units': 'imperial',
      'lat': latitude,
      'lon': longitude
  }
  response = requests.put(
      OPEN_WEATHER_MAP_URL + WEATHER_URL,
      params=params)
  if response.status_code != 200:
    logging.exception('Unexpected response: ', response.text)
  response_parsed = response.json()
  if 'main' not in response_parsed or 'temp' not in response_parsed['main']:
    logging.exception('Expected fields not in response: ', response.text)
  return response_parsed['main']['temp']
{'fraction_non_alphanumeric': 0.12895662368112543, 'fraction_numerical': 0.005861664712778429, 'mean_word_length': 4.401898734177215, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1614603', 'n_tokens_mistral': 562, 'n_tokens_neox': 545, 'n_words': 129}