(This is a memo about python of GAE 1gen that I wrote a long time ago, but I will drop it because it is in the draft. I think that it is unnecessary because GAE 2gen is the mainstream now)
When referencing GCS from GAE / py, there is a case of a file name that requires URL encoding, so I was a little addicted to it, so make a note of it. In addition, this problem is not a problem when you touch REST API etc. by yourself, it is just a story that the quote processing of cloudstorage library for GAE was not consistent.
The App Engine documentation refers to a library called the Google Cloud Storage Client Library ().
The name is inconsistent,
pip install GoogleAppEngineCloudStorageClient
It is a library that can be used.
The repository name on github is appengine-gcs-client, so this name may be correct. It seems that there are one for java and one for python, but this time we are talking about the library for python.
As a feature, I think it's a file-like wrapping interface that uses App Engine credentials to access Cloud Storage's REST API.
The only thing that got stuck this time was that the request was not made according to the REST API specifications. This was because there was a part where URL quote processing was omitted in the implementation of client library.
I was addicted to the copy2 (src, dst)
method, which src is URL-encoded. Even though it didn't work, the strings passed to other methods and dst were URL-encoded.
The reason is simple: the other arguments are mostly passed as path parameters, so ʻurllib.quote () processing is written, whereas The src of the copy2 method is the REST API header parameter [
x-goog-copy-source](https://cloud.google.com/storage/docs/xml-api/reference-headers?hl=ja#xgoogcopy) Because it was passed as ʻurllib.quote ()
processing was not written.