一意の URL を生成して、https://goo.gl/でこれを確認しようとしています。Pythonでの私のコード:
import requests
import json
def goo_shorten_url(url):
post_url = 'https://www.googleapis.com/urlshortener/v1/url?key=xxxxxxxxxxxxxxxxxxxx'
payload = {'longUrl': url}
headers = {'content-type': 'application/json'}
r = requests.post(post_url, data=json.dumps(payload), headers=headers)
print r.text
goo_shorten_url('http://www.google.com')
ただし、この一意の URL を取得するためにコードを変更してトークンを構成する方法がわかりません