title: How to implement a retry option in PyCurl
body: <p>How could I implement a retry option within the PyCurl (libcurl) module in python? Something similar to the effect of: </p>
  
  <p>curl --retry 3 --retry-delay 5 '<a href="http://somesite.com/somefile" rel="nofollow noreferrer">http://somesite.com/somefile</a>'</p>
  
  <p>Current code:</p>
  
  <pre><code>buffer = BytesIO()
  c = pycurl.Curl()
  c.setopt(c.URL, 'http://somesite.com/somefile')
  with open('output.txt','w') as f:
    c.setopt(c.WRITEFUNCTION, f.write)
    c.perform()
  </code></pre>