Created
March 9, 2017 17:10
-
-
Save mrueegg/6050a3f79601b8fc52b96b7cfcd5447f to your computer and use it in GitHub Desktop.
Create an OAuth request token with Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from oauthlib.oauth1 import SIGNATURE_RSA | |
from requests_oauthlib import OAuth1Session | |
import json | |
import webbrowser | |
request_token_url = 'http://localhost:6990/bamboo/plugins/servlet/oauth/request-token' | |
oauth = OAuth1Session(your_consumer_key_from_above, | |
signature_type='auth_header', | |
signature_method=SIGNATURE_RSA, | |
rsa_key=your_RSA_key_from_above) | |
request_token = oauth.fetch_request_token(request_token_url) | |
Next, we have to get the authorization of the user: | |
authorize_url = 'http://localhost:6990/bamboo/plugins/servlet/oauth/authorize' | |
auth_link = '{}?oauth_token={}'.format(authorize_url, request_token['oauth_token'])) | |
webbrowser.open(auth_link) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment