Is there a working OAuth library for Python 3?
oauth, oauth-2.0, python, python-3.x
Solution
It looks like Requets_oauthlib works. Here's code I used that works in Python 3. I'm posting it because most of the example code I found used formats that I couldn't get working.
from requests_oauthlib import OAuth1
client_key = ''
client_secret = ''
resource_owner_key = ''
resource_owner_secret = ''
def query(queryurl):
headeroauth = OAuth1(client_key, client_secret, resource_owner_key,
resource_owner_secret, signature_type = 'auth_header')
return requests.get(queryurl, auth = headeroauth)
query('http://website.com')
Problem
What's the most current form of Oauth for Python 3? I'm trying to create a stock screener using my broker's API, which uses Oauth. Most of the info I find is out of date or conflicting. I've seen the following modules referenced: Oauth - Seems to be the original, now outdated. I get an error of "'module' object has no attribute 'Consumer'" Oauth2 - Newer version, apparently also outdated? The one most referenced one online. Glitches out in pip/can't figure out how to install it. Oauthlib - IIRC, claims to be the new replacement for Oauth and Oauth2 Rauth.OAuth2Service - Also potentially replacement for Oauth and Oauth2? Requests - ? Oauth_hook - ? pyoauth2 - I get an error about not having a module named "client" in pyoauth2's init. None of them seem to work as expected, and I have a feeling that this is due to low Oauth 3 support. Have you gotten OAuth to work in Python 3? If so, how did you do it?