Follow redirects correctly #36

Closed
sqrrrl opened this Issue Apr 8, 2013 · 3 comments

Comments

Projects
None yet
2 participants
Member

sqrrrl commented Apr 8, 2013

(From https://code.google.com/p/google-api-ruby-client/issues/detail?id=66)

What steps will reproduce the problem?

  1. Make a call to a Google API which requires a redirect.

What is the expected output? What do you see instead?
Expected output: redirect followed
What did I see: redirect not followed

What version of the product are you using? On what operating system?
Latest version of google-api-ruby-client on a gubuntu box (Ubuntu 12.04.1), ruby 1.9.3

+1 on wanting to see this issue fixed.
Within the standard Google Doubleclick DFA Reporting API, requests to retrieve files (https://developers.google.com/doubleclick-advertisers/reporting/v1.3/files/get) result in a redirect, and the Ruby API Client is not following those redirects. Thus, the (ugly) workaround involves parsing the response headers out of the client like this:

resp = client.execute(:api_method => dfa.reports.files.get, ...)
real_url  = resp.response.env[:response_headers]["location"]
Curl::Easy.http_get real_url
Member

sqrrrl commented Jan 22, 2014

Fixed in 0.7 if retries are enabled. Can do:

client.retries = 3 # Retry up to 3 times on recoverable errors.

@sqrrrl sqrrrl closed this Jan 22, 2014

Thanks! This solves our issue perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment