Python3でPicasa APIによるGoogle Photoの写真を取得
PicasaAPIを使って、アルバムデータを取得し、Web上にデータを表示させようとしていますが上手くできません。
発生している問題・エラーメッセージ
Unknown authorization header
該当のソースコード
python
1flow = flow_from_clientsecrets( 2 'secret/client_secrets.json', 3 scope='https://picasaweb.google.com/data/', 4 redirect_uri="urn:ietf:wg:oauth:2.0:oob" 5 ) 6 7auth_uri = flow.step1_get_authorize_url() 8webbrowser.open(auth_uri) 9 10token = input("Input your code > ") 11 12credentials = flow.step2_exchange(token) 13 14# file.Storage 15storage = Storage('secret/credentials') 16storage.put(credentials) 17 18json_file = open("secret/credentials") 19load = json.load(file) 20 21access_token = load["access_token"] 22 23url = 'https://picasaweb.google.com/data/feed/api/user/UserID/' 24head = {'Authorization': 'access_token {}'.format(access_token)} 25print(head) 26response = requests.get(url, headers=head) 27print(response.text)
試したこと
OAuth認証に必要なclient_idやclient_secret等は 'secret/client_secrets.json'ファイルに入っています。
UserIDには自分のIDを入力した上で起きた問題です。
よろしくお願い致します。
回答2件
あなたの回答
tips
プレビュー