python - google storage acl change on existing object -


im having problems understanding how put headers change acl on exixting object on google storage developers. need manually without boto or other helper libs.

what need set object public private , other way around.

this example found on the developers guide

put /paris.jpg?acl http/1.1 host: travel-maps.commondatastorage.googleapis.com date: mon, 15 feb  2008 21:30:39 gmt content-length: 0 authorization: goog1 googts7c7fup3airvjte:y9gblaeinilfv5zlam9ts= x-goog-acl: private  <empty entity body> 

what not clear me , im stuck how build signature. signature composed by:

signature = base64-encoding-of(hmac-sha1(utf-8-encoding-of(yourgooglestoragesecretkey, messagetobesigned))) 

i dont know header parts should include, exclude, newlines.... compose messagetobesigned. have python sample code doing similar?

thank you!

first, recommend using the json api google's api client libraries, make make authorization easier in variety of language.

second, recommend authenticating oauth instead of hmac. easier because can send access token on https instead of figuring out how sign request. every request authenticated along lines of:

authorization: oauth bearer 1/2093840249809382402890948 

that being said, take here: https://developers.google.com/storage/docs/reference/v1/developer-guidev1#authentication

messagetobesigned defined utf8 encoding of canonical headers, extension headers , resource:

messagetobesigned = utf-8-encoding-of(     canonicalheaders +     canonicalextensionheaders +     canonicalresource) 

the headers are:

canonicalheaders = http-verb + "\n" + content-md5 + "\n" + content-type + "\n" + date + "\n" 

etc...

if generate wrong message sign google return expected string sign in response body. easiest way verify generating right string sign compare string string google expects.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -