Split a full s3 path into the bucket name and path.
(url)
| 111 | |
| 112 | |
| 113 | def split_s3_path(url): |
| 114 | """Split a full s3 path into the bucket name and path.""" |
| 115 | parsed = urlparse(url) |
| 116 | if not parsed.netloc or not parsed.path: |
| 117 | raise ValueError("bad s3 path {}".format(url)) |
| 118 | bucket_name = parsed.netloc |
| 119 | s3_path = parsed.path |
| 120 | # Remove '/' at beginning of path. |
| 121 | if s3_path.startswith("/"): |
| 122 | s3_path = s3_path[1:] |
| 123 | return bucket_name, s3_path |
| 124 | |
| 125 | |
| 126 | def s3_request(func): |