title: how do i use json api in my kivy program
body: <p>hi I'm currently reading O'Reilly's Creating Apps in Kivy and there's an example that I can't get it to work correctly because by the time he wrote the book <a href="http://openweathermap.org" rel="nofollow">openWeatherMap</a> didn't require api key (APPID) but now it does and I'm a novice programmer and don't know how to change the code so it would work.</p>
  
  <p>this is the main.py source code:</p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.boxlayout import BoxLayout
  from kivy.properties import ObjectProperty
  from kivy.network.urlrequest import UrlRequest
  import json
  
  class AddLocationForm(BoxLayout):
      search_input = ObjectProperty()
  
  def search_location(self):
      search_template = "http://api.openweathermap.org/data/2.5" + "find?q={}&amp;type=like"
      search_url = search_template.format(self.search_input.text)
      request = UrlRequest(search_url, self.found_location)
  
  def found_location(self, request, data):
      data = json.loads(data.decode()) if not isinstance(data, dict) else data
      cities = ["{} ({})".format(d['name'], d['sys']['country'])
          for d in data['list']]
      self.search_results.item_strings = cities
      print("\n".join(cities))
  
  class WeatherApp(App):
  pass
  
  if __name__ == '__main__':
  WeatherApp().run()
  </code></pre>
  
  <p>and this is weather.kv source code:</p>
  
  <pre><code>AddLocationForm:
  
  &lt;AddLocationForm&gt;:
      orientation: "vertical"
      search_input: search_box
      search_results: search_results_list
      BoxLayout:
      height: "40dp"
      size_hint_y: None
      TextInput:
          id: search_box
          size_hint_x: 50
      Button:
          text: "Search"
          size_hint_x: 25
          on_press: root.search_location()
      Button:
          text: "Current Location"
          size_hint_x: 25
  ListView:
      id: search_results_list
      item_strings: []
  </code></pre>
  
  <p>the code's simple you put a city name in textbox and hit search and it confirms it by showing the name it recieved.</p>