0

私は今、その API を使用して、sina weibo クローラーを起動しています。API を使用するには、oauth2 認証ページにアクセスして URL からコードを取得する必要があります。

これはまさに私が行う方法です:

  1. app_key と app_secret を使用します (どちらも既知)

  2. oauth2 ウェブページの URL を取得する

  3. 応答 URL からコードを手動でコピーして貼り付けます。

これは私のコードです:

#call official SDK
client = APIClient(app_key=APP_KEY, app_secret=APP_SECRET, redirect_uri=CALLBACK_URL)

#get url of callback page of authorization
url = client.get_authorize_url()
print url

#open webpage in browser
webbrowser.open_new(url)

#after the webpage responding, parse the code part in the url manually
print 'parse the string after 'code=' in url:'
code = raw_input()

私の質問は、手動で解析する部分を取り除く方法です?

参照: http://blog.csdn.net/liuxuejiang158blog/article/details/30042493

4

1 に答える 1