title: Handling Large amounts of data and Requesting API's
body: <p>I have a lot of postcodes (over 12,000) and need to request these from an API and save the response.</p>
  
  <p>My current solution is to request them all individually but python returns 
  <code>RecursionError: maximum recursion depth exceeded during compilation</code> 
  and there are over 37,000 lines.</p>
  
  <p>I am looking for a simpler way to request all of the postcodes and save the response.</p>
  
  <p>Below is the code for requesting one postcode at a time and saving it</p>
  
  <p>The postcodes are stored in an Excel Spreadsheet.</p>
  
  <pre><code># Import Libraries
  import urllib.parse
  import requests
  from datetime import datetime
  
  # Call the API
  main_api = 'https://doitonline.york.gov.uk/BinsApi/EXOR/getWasteCollectionsForPostCode?'
  postcode = "YO1 6EH"
  
  url = main_api + urllib.parse.urlencode({'postcode': postcode})
  
  json_data = requests.get(url).json()
  
  print(json_data)
  now = datetime.now()
  
  saveFile = open("test"+str(now)+".txt", "w")
  saveFile.write(str(json_data))
  saveFile.close()
  </code></pre>
  
  <p>Thanks,
  Ben</p>