-
Notifications
You must be signed in to change notification settings - Fork 870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot download CSV/Media file using DfareportingService#get_file
#290
Comments
Will take a look at. Would be helpful if you can capture the raw HTTP response from the download request (e.g. using curl or whatever) since I don't have a DFA account I can use to test. Just need to verify that they're sending a proper redirect. FYI, you can simplify the workaround a little - there's a generic http() method on the service that will service.http(:get, file_metadata.urls.api_url, download_dest: '/tmp/report.csv') |
Don't need the HTTP response. Was able to reproduce and am looking at a fix. Might be a little while though since the preferred fix involves some fixes to Hurley (http library) |
Thank you! |
@rafaelsales did you use google services accounts to connect to the DCM webservice ?. I need to work with that webservice but I have problems about permisions when my script connects with that Webservice using google service account. Are you using that flow connection ? Thank you |
I can confirm google account service doesn´t works with DCM if the google Apps Domain is not setup. |
I couldn't access DFA reporting service with service account. Had to use client id, client secret and manually create a first refresh token. |
btw, I tried with my company google apps |
Rafaelsales thank you for your reply. I could make it work using installed flow. there is no needed to use google apps with this authentication flow, this way is recommended by google. |
@bruzos when you say "it work" you mean the |
Hi @rafaelsales I have tried your code with the same behavior you wrote. I think the problem is in the Hurley client it doesn't handle redirections. |
@bruzos I'm pretty sure Hurley actually does follow redirects: https://github.com/lostisland/hurley/blob/9be84b325c9a396a64268cd7bbca94080d9485ee/test/client_test.rb#L319 See the method |
It's a combination of api client + hurley bugs. The issues with the client is it isn't expecting a redirect for downloads. APIs aren't supposed to redirect here, but a few do and the client should handle it. The problem is that Hurley is broken when it comes to streaming responses and redirects. There is a mechanism to filter streaming responses by status code, but it doesn't work. There's also a 2nd issue that it loses track of the fact that the caller wants to stream when a redirect happens. There are pending PRs (lostisland/hurley#28) and lostisland/hurley#34)) for both issues that I hope will be in the next release of Hurley. Once those are fixed I'll update the client to handle the redirect properly. |
@sqrrrl and @rafaelsales thank you very much. I will patiently wait for it :) |
@sqrrrl thanks a lot for the explanation! |
Hi @sqrrrl it seem the pending PRs for Hurley client we was waiting for have been merged to master. |
… on 20x response. Includes temporary patch to Hurley until 0.3 released
They have been, but still not released so I can do a proper dependency on them. That said, I did hack in a fix for the next release which I'll push shortly. |
Issues: Option
download_dest
inDfareportingService#get_file
does not work.Testing file:
Outcome:
Expectation: The
get_file(..., download_dest: ...)
should have downloaded the file correctly, instead if returns that "Temporary Redirect" page.The text was updated successfully, but these errors were encountered: