Lispython / human_curl

Simple Human wrapper for cURL library
http://h.wrttn.me/human_curl
Other
205 stars 43 forks source link

please add retry #17

Closed moon126 closed 11 years ago

moon126 commented 12 years ago

http://curl.haxx.se/docs/manpage.html --retry

If a transient error is returned when curl tries to perform a transfer, it will retry this number of times before giving up. Setting the number to 0 makes curl do no retries (which is the default). Transient error means either: a timeout, an FTP 4xx response code or an HTTP 5xx response code.

When curl is about to retry a transfer, it will first wait one second and then for all forthcoming retries it will double the waiting time until it reaches 10 minutes which then will be the delay between the rest of the retries. By using --retry-delay you disable this exponential backoff algorithm. See also --retry-max-time to limit the total time allowed for retries. (Added in 7.12.3)

If this option is used several times, the last one will be used.

--retry-delay

Make curl sleep this amount of time before each retry when a transfer has failed with a transient error (it changes the default backoff time algorithm between retries). This option is only interesting if --retry is also used. Setting this delay to zero will make curl use the default backoff time. (Added in 7.12.3)

If this option is used several times, the last one will be used.

--retry-max-time

The retry timer is reset before the first transfer attempt. Retries will be done as usual (see --retry) as long as the timer hasn't reached this given limit. Notice that if the timer hasn't reached the limit, the request will be made and while performing, it may take longer than this given time period. To limit a single request´s maximum time, use -m, --max-time. Set this option to zero to not timeout retries. (Added in 7.12.3)

If this option is used several times, the last one will be used.

Lispython commented 12 years ago

Could you tell me, what pycurl params need to user retry? I can't find its.

moon126 commented 11 years ago

Hi, Example: import human_curl as hurl r = hurl.get("http://www.google.com/" , retries=3, proxy = ('socks4', ("69.59.140.30", 1080 )))

When you request fails use proxy,retry request.