Skip to content

Commit a779dcc

Browse files
committed
black checker
1 parent 8b90689 commit a779dcc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/jira/jira_oauth2.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
The server request to {server_url}/login is redirected to Jira.
3636
The user is asked to grant access permissions.
3737
"""
38+
39+
3840
@app.route("/login")
3941
def login():
4042
scope = ["read:me", "read:jira-user", "read:jira-work"]
@@ -48,23 +50,29 @@ def login():
4850
session["oauth_state"] = state
4951
return redirect(authorization_url)
5052

53+
5154
"""
5255
3. Jira redirects user to callback url with authorization code
5356
This should be set to {server_url}/callback.
5457
Access token is fetched using authorization code
5558
"""
59+
60+
5661
@app.route("/callback")
5762
def callback():
5863
jira_oauth = OAuth2Session(client_id, state=session["oauth_state"], redirect_uri=redirect_uri)
5964
token_json = jira_oauth.fetch_token(token_url, client_secret=client_secret, authorization_response=request.url)
6065
return "Token: {}<p />Projects: {}".format(token_json, ", ".join(get_projects(token_json)))
6166

67+
6268
"""
6369
4. Access Token used for Jira Python API
6470
Using access token, accessible resources are fetched and
6571
First resource id is taken as jira cloud id,
6672
Jira Client library is called with jira cloud id and token information.
6773
"""
74+
75+
6876
def get_projects(token_json):
6977
req = requests.get(
7078
"https://api.atlassian.com/oauth/token/accessible-resources",

0 commit comments

Comments
 (0)