title: Call an API multiple times with a different URL in Python
body: <p>I'm using Zillow's API and making a call to the <code>GetDeepComps</code> API. The API allows you to include an address in the URL, then returns a response.</p>
  
  <p>I want to send multiple requests to the API by reading a text file full of x addresses and then calling the API x times, until there are no more addresses remaining in the file.</p>
  
  <p>The value of the variable <code>formatted_addresses</code> should change depending on the line being read in the text file containing the addresses.</p>
  
  <p>I also want to store the address and its corresponding zip code in a dictionary.
  Here's my current code.</p>
  
  <pre><code>def read_addresses_and_append_zip_codes():
      f = open("addresses.txt", "r")
      addresses = f.readlines()
      addresses = [x.strip() for x in addresses]
      print addresses
      formatted_address = "2723+Green+Leaf+Way"
      DEEP_SEARCH_RESULTS_BASE_URL = "http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=" + API_KEY + "&amp;address=" + formatted_address + "&amp;citystatezip=San%20Antonio%2C%20TX"
      response = requests.get(DEEP_SEARCH_RESULTS_BASE_URL)
      content = xmltodict.parse(response.content)
      zip_code = content['SearchResults:searchresults']['response']['results']['result']['address']['zipcode']
      print zip_code
  
  
  read_addresses_and_append_zip_codes()
  </code></pre>
  
  <p>What's a good way to do this?</p>