py-oauth2.

Ein Python-Wrapper für die OAuth 2.0-Spezifikation
Jetzt downloaden

py-oauth2. Ranking & Zusammenfassung

Anzeige

  • Rating:
  • Lizenz:
  • MIT/X Consortium Lic...
  • Preis:
  • FREE
  • Name des Herausgebers:
  • liluo
  • Website des Verlags:
  • https://github.com/liluo/

py-oauth2. Stichworte


py-oauth2. Beschreibung

PY-OAUTH2 ist ein Python-Wrapper für die OAuth 2.0-Spezifikation.Installationspip: PIP installieren Py-oAuth2easy_install: easy_install py-oauth2Sage-BeispieleBeispiele für GoogleGe-Benutzerinfo: von OAuth2 Importieren Sie ClientClient_ID = '' client_secret = '' redirect_url = '' Scope = '' redirect_url = '' scope = 'https : //www.googleapis.com/auth.googleapis.com/audps://www.googline.com/auth/uerinfo.email'klient = Client (client_id, client_secret, site = 'https: //www.googleapis.com / oauuth2 / v1 ', autorize_url =' https: //accounts.google.com/o/oAuth2/Auth ', token_url =' https: //accounts.google.com/o/oAuth2/token ') drucken' - ' * 80Authorize_url = client.Auth_Code.Authorize_URL (redirect_uri = redirect_url, scope = scope) drucken 'Gehen Sie zum folgenden Link in Ihrem Browser:' drucken authentourize_urlcode = raw_input ('Geben Sie den Bestätigungscode ein und drücken Sie die Eingabetaste, wenn Sie dies tun:' ) Code = code.strip () access_token = client.Auth_code.get_token (Code, redirect_uri = redirect_url) drucken 'token', access_token.headersdrint '-' * 80Print 'Get User Info'ret = access_token.get (' / userinf o ') drucken ret.parSeddemo für doubanget access_token: von oAuth2 Import Clientkey =' 'secret =' 'callback =' 'Client = Client (Schlüssel, Geheimnis, Site =' https: //api.douan.com ', autorize_url = 'https://www.douan.com/service/Auth2/auth', token_url = 'https: //www.douan.com/service/Auth2/token') autorisieren_url = client.Auth_Code.Autorize_URL (redirect_uri = Rückruf, Scope = 'shuo_basic_w, doBan_basic_common') access_token = client.Auth_Code.Get_Token (Code, redirect_uri = Callback) Erhalten Sie Daten: ret = acces_token.get ('/ people / @ me', alt = 'json') drucken ret.parSedupload Bild : ret = acces_token.post ('/ shuo / status /', text = 'Inhalt von py-oauuth2', Dateien = {'Image': Öffnen ('/ path / pic.jpg')}) drucken Ret.ParSedProduct's Homepage


py-oauth2. Zugehörige Software