質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Q&A

解決済

1回答

8982閲覧

Googleの審査プロセスが完了しない

Tom_yamada

総合スコア9

Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

0グッド

1クリップ

投稿2023/01/13 10:19

前提

以下のサイトを参考にGoogle Drive APIを利用するためにPythonのクイックスタートを行いました.
[https://developers.google.com/drive/api/quickstart/python]
サンプルコードを実行したところアクセスがブロックされてしまいました.

実現したいこと

アクセスが承認できるようにする

発生している問題・エラーメッセージ

以下の画像のようにアクセスがブロックされてしまう.
イメージ説明

該当のソースコード

Python

1from __future__ import print_function 2 3import os.path 4 5from google.auth.transport.requests import Request 6from google.oauth2.credentials import Credentials 7from google_auth_oauthlib.flow import InstalledAppFlow 8from googleapiclient.discovery import build 9from googleapiclient.errors import HttpError 10 11# If modifying these scopes, delete the file token.json. 12SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'] 13 14 15def main(): 16 """Shows basic usage of the Drive v3 API. 17 Prints the names and ids of the first 10 files the user has access to. 18 """ 19 creds = None 20 # The file token.json stores the user's access and refresh tokens, and is 21 # created automatically when the authorization flow completes for the first 22 # time. 23 if os.path.exists('token.json'): 24 creds = Credentials.from_authorized_user_file('token.json', SCOPES) 25 # If there are no (valid) credentials available, let the user log in. 26 if not creds or not creds.valid: 27 if creds and creds.expired and creds.refresh_token: 28 creds.refresh(Request()) 29 else: 30 flow = InstalledAppFlow.from_client_secrets_file( 31 'credentials.json', SCOPES) 32 creds = flow.run_local_server(port=0) 33 # Save the credentials for the next run 34 with open('token.json', 'w') as token: 35 token.write(creds.to_json()) 36 37 try: 38 service = build('drive', 'v3', credentials=creds) 39 40 # Call the Drive v3 API 41 results = service.files().list( 42 pageSize=10, fields="nextPageToken, files(id, name)").execute() 43 items = results.get('files', []) 44 45 if not items: 46 print('No files found.') 47 return 48 print('Files:') 49 for item in items: 50 print(u'{0} ({1})'.format(item['name'], item['id'])) 51 except HttpError as error: 52 # TODO(developer) - Handle errors from drive API. 53 print(f'An error occurred: {error}') 54 55 56if __name__ == '__main__': 57 main()

試したこと

環境のセットアップは完了しています.
個人利用なのでGoogleCloudでプロジェクトを作成する際の場所(location)は「組織なし」になっているのですが親組織がないと使用できないといったことはあるのでしょうか?.
画像の「現在テスト中」が時間経過で使えるようになるのなら良いのですが,そんなに何日もかかるものなのでしょうか.
(デスクトップアプリ利用の場合大体何日かかるか分かれば教えていただきたいです.)

補足情報(FW/ツールのバージョンなど)

Python 3.11.1

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

GoogleCloudのプロジェクト作成の際にOAuth同意画面でテストユーザーを追加していなかった.

投稿2023/01/14 06:07

Tom_yamada

総合スコア9

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問