Information gleamed from here.
Given that I have a ACCESS_TOKEN
and a APP_ID
, I should be able to update a chrome extension using the following.
r = requests.put(
'https://www.googleapis.com/upload/chromewebstore/v1.1/items/%s' % APP_ID,
headers={'Authorization': "Bearer %s" % ACCESS_TOKEN,
'x-goog-api-version': "2"},
files={'file': open('target_extension.crx', 'rb')})
print r.text
Prints:
{"error":{"errors":[{"domain":"global","reason":"notUpload","message":"Not an upload request. Re-send request to: https://www.googleapis.com/chromewebstore/v1.1/items/fmcklaikklmlfahjgdndacebapkpefan"}],"code":400,"message":"Not an upload request. Re-send request to: https://www.googleapis.com/chromewebstore/v1.1/items/fmcklaikklmlfahjgdndacebapkpefan"}}
Ok, seems clear enough, I switch the url:
r = requests.put(
'https://www.googleapis.com/chromewebstore/v1.1/items/%s' % APP_ID,
headers={'Authorization': "Bearer %s" % ACCESS_TOKEN,
'x-goog-api-version': "2"},
files={'file': open('target_extension.crx', 'rb')})
print r.text
Prints:
{"error":{"errors":[{"domain":"global","reason":"wrongUrlForUpload","message":"Uploads must be sent to the upload URL. Re-send this request to https://www.googleapis.com/upload/chromewebstore/v1.1/items/fmcklaikklmlfahjgdndacebapkpefan"}],"code":400,"message":"Uploads must be sent to the upload URL. Re-send this request to https://www.googleapis.com/upload/chromewebstore/v1.1/items/fmcklaikklmlfahjgdndacebapkpefan"}}
So one says I am not a upload, switch. And the other one says I am a upload, switch back. What am I doing wrong here?