title: Django-celery task to fetch json data from API + error handling
body: <p>I'm a noob when it comes to working with APIs in python/django...</p>
  
  <p>I have a celery task set up to fetch .json data from NYC open data and turn it into objects saved to my database. The task is set to run once each day. </p>
  
  <p>I'm sort of confused about using a try/except block for the data request - I want to make sure that the data is fetched once per day, but I'm not sure what I need to do to make sure that the request is retried if there is a problem.</p>
  
  <pre><code>query_string = "http://data.cityofnewyork.us/resource/erm2-nwe9.json?$where=created_date&gt;=%s" % new_date
  result = requests.get(query_string, headers={'X-App-Token': apptoken})
  </code></pre>
  
  <p>The requests docs show exceptions for HTTPError, Timeout, TooManyRedirects, etc. Should I write an exception for each one of those? I'm not sure what to write for the exception other than to just repeat the second line that gets the data. </p>
  
  <p>If I have an exception and then put the requests.get line right under it, will it keep trying until the request is successful?</p>
  
  <p>Or do I need to alter something in the celery task so that if the request fails when it runs at midnight, it will try it again at some other time? (Not sure how to do that even after reading the docs.)</p>