第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

使用 O-Auth 在 Flask 應(yīng)用程序上訪問(wèn) Google My Business

使用 O-Auth 在 Flask 應(yīng)用程序上訪問(wèn) Google My Business

GCT1015 2022-05-19 16:01:37
我正在嘗試在燒瓶應(yīng)用程序上訪問(wèn) Google My Business API,但遇到了問(wèn)題。我已經(jīng)使用授權(quán)和 oauth-callback 函數(shù)設(shè)置了 O-Auth 過(guò)程。oauth 聲稱一切正常,因?yàn)樗瓿闪?oauth-callback 函數(shù)并重定向到位置方法。我在構(gòu)建函數(shù)中添加了一個(gè)開(kāi)發(fā)者 api 密鑰。當(dāng)我嘗試使用 build 函數(shù)建立與 api 的連接時(shí),我得到了這個(gè):googleapiclient.errors.UnknownApiNameOrVersion: name: mybusiness version: v4. 我很確定是正確的 api 詳細(xì)信息,因?yàn)樵跊](méi)有 oauth 的命令行版本中,api 名稱和版本號(hào)有效。我卡住了,我認(rèn)為錯(cuò)誤消息可能有點(diǎn)誤導(dǎo),也許我的 oauth 過(guò)程有問(wèn)題。我做的不對(duì)?我已經(jīng)使用相同的程序嘗試了 google drive api 并且它有效。我還確保在 google 開(kāi)發(fā)者控制臺(tái)中啟用了 google my business api。這是授權(quán)功能:@bp.route('/authorize')def authorize():    # Create flow instance to manage the OAuth 2.0 Authorization Grant Flow steps.    flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file(        CLIENT_SECRETS_FILE, scopes=SCOPES)    # The URI created here must exactly match one of the authorized redirect URIs    # for the OAuth 2.0 client, which you configured in the API Console. If this    # value doesn't match an authorized URI, you will get a 'redirect_uri_mismatch'    # error.    flow.redirect_uri = url_for('google_questions.oauth2callback', _external=True)    code_verifier = generate_code_verifier()    flow.code_verifier = str(code_verifier)    flask.session['code_verifier'] = str(code_verifier)    authorization_url, state = flow.authorization_url(        # Enable offline access so that you can refresh an access token without        # re-prompting the user for permission. Recommended for web server apps.        access_type='offline',        # Enable incremental authorization. Recommended as a best practice.        include_granted_scopes='true')    # Store the state so the callback can verify the auth server response.    flask.session['state'] = state    apobj.notify(title='Auth url',        body=authorization_url)    return redirect(authorization_url)這是 oauth 回調(diào)函數(shù):@bp.route('/oauth2callback')def oauth2callback():  # Specify the state when creating the flow in the callback so that it can  # verified in the authorization server response.
查看完整描述

1 回答

?
波斯汪

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超4個(gè)贊

google-api-python-client 查找默認(rèn)不包含 mybusiness v4 的發(fā)現(xiàn)文檔。您可以在此處找到代碼https://github.com/googleapis/google-api-python-client/blob/master/googleapiclient/discovery.py您可以使用 discoveryServiceUrl 參數(shù)指定發(fā)現(xiàn)文檔。將其設(shè)置為:

discoveryServiceUrl='https://developers.google.com/my-business/samples/mybusiness_google_rest_v4p5.json'

您的完整版本應(yīng)如下所示:

business = googleapiclient.discovery.build(
        API_SERVICE_NAME, API_VERSION, credentials=credentials, discoveryServiceUrl='https://developers.google.com/my-business/samples/mybusiness_google_rest_v4p5.json')



查看完整回答
反對(duì) 回復(fù) 2022-05-19
  • 1 回答
  • 0 關(guān)注
  • 189 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)