-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add as_url
method to each CloudPath implementation with ability to generate presigned_urls
#236
Conversation
…ery useful for localstack while waiting for upstream PR from boto3: boto/boto3#2746
@kabirkhan Thanks for this, I think the implementation is looking great. A few questions: (1) Do you know if any of the provider specific SDKs support getting the URL? Might be more reliable than the f-string version, even in the non-presigned case Other than those qs, this will need:
Also, do you have creds that you can use to test the various live versions of the services? If not, I can share some with you. |
@kabirkhan I know this is a little old, but I'm pushing to get some valuable stale PRs in if possible. Would you have time to wrap the implementation here with the items above? |
Hey @pjbull, I found some time! lol sorry for the super late reply here. I ended up not needing this for my work but it popped in my head that I never finished this and it's legitimately a useful addition. Finished up the main code changes and this now uses the SDK of each provider to get the public URLs as well so local emulators should work. Started working on the tests as well but not all the there yet. |
Awesome, thanks @kabirkhan! I actually had just had to reach into the I'll take a look this weekend. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #236 +/- ##
========================================
- Coverage 94.3% 93.9% -0.5%
========================================
Files 22 22
Lines 1560 1615 +55
========================================
+ Hits 1472 1517 +45
- Misses 88 98 +10
|
Thanks @kabirkhan! Moving to local branch to run the live backend tests |
* Add `as_url` method to each CloudPath implementation with ability to generate presigned_urls (#236) * Add ability to set endpoint_url from AWS_ENDPOINT_URL env variable. Very useful for localstack while waiting for upstream PR from boto3: boto/boto3#2746 * add test * rm print * lint * initial implementation of as_url for presigned urls * add az implementation * fix non-presigned urls for each cloud * fix az presigned url * actually test and fix urls across implementations. conditional keys * use sdks to get presigned and public urls (gs and s3) * use sdk to get public url as well * rm extra commented out * add basic implementations for new url methods for local * black format * rm unused import * fix sig * add url stuff to the mock test client * format * fix up tests for each specific rig * don't use a test that requires creds in s3 specific * lint * rm path checks that wouldn't work on windows for local mocks * format * update docs * move default implementation to cloudpath * Update tests and documentation --------- Co-authored-by: Kabir Khan <[email protected]>
Overview
Adds an
as_url
method that returns thehttps://
address of the object or generates a presigned URL ifpresign=True
is passed.Based on #235
Usage
Open Questions
1. What should we call this method?
as_url
would be fine but there's already the Pathlibas_uri
method so it's probably confusing.Maybe we make
as_uri
return the defaulthttps://
address for the blob instead of the str of the Path. Then we have this method for generating presigned urls be more specific (e.g.get_signed_url
)So for the above example: