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
1. added possibility to download file with context manager #240
Conversation
Greetings! Thanks for the proposal! Although your scenario is supported and with current implementation file could be downloaded like this (from abs url)
In a similar manner file could be downloaded by server relative url, refer Introducing |
yes, that makes sense. Actually first example does not support Context with App auth. Or is there a method in File class? while second example works fine for this type but uses directly context manager, which is fine |
@vgrem I do not see a method to download file from abs_url and using App Auth or do I overlook something? |
@beliaev-maksim, probably you've installed the package via pip, right? If so, unfortunately it does not correspond to the latest version, please refer this thread for the details. Meanwhile, would recommend to download the latest version via GitHub
or alternative index: In the latest version file could be downloaded like this:
|
I will not exclude possibility that I am completely stupid :) However, how does this work for App Auth? in which place does ACSTokenProvider is executed?
|
@vgrem If you do not mind I would be glad to have a short audio call where can explain my idea |
Hi @beliaev-maksim, here is a complete example which demonstrates how to:
We could arrange a call (if needed), but not sure when i have any spare time this week yet. |
I tried this method, this does not work for me if you go deep level by level of this solution there is no place where you call: so basically this method works only for standard auth with username and password when I use method I propose I get: if I use example you provided: |
@beliaev-maksim , you know what, it appears you are right and spotted the bug, it appears context is getting lost is this case, will double check and get back to you. |
Hey, the latest version available from GitHub contains a fix to prevent Could you give it another shot? |
@vgrem I use following code with the latest pull from upstream
error is the same and I think this is again because we do not acquire token in this method In this case I would say with_context method simplifies how library should behave. Basically if methods changed/added the method will still work. I see the concern about protecting context property. So may be we can fix a bug in different way we can reset the call today |
Even i had similar use case and i tried in latest v2.1.10.1, it shows ValueError: Unknown credential type. please clarify. |
I also tried the above code and get the following error using client id/secret: Can someone perhaps provide a solution if there is one without using username/password? |
you can use solution from my fork: branch with fix is called: context_download |
@beliaev-maksim Can I also upload with your fork via the context? Not sure if upload was ever a problem with this but it was something I was going to try after getting a download to work. |
should work. see example in download_file_from_url_app_auth.py there you get a context. smth like following:
|
@beliaev-maksim how do you install your fork and branch with pip? |
Not sure if this function is not implemented in different way.
If already there please let me know and I will recreate example for such scenario