This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOAuthCheck.py
41 lines (32 loc) · 1.54 KB
/
OAuthCheck.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# import the neccessary libraries to open webpages
import requests
import webbrowser
# import json #only if the user's details need to be written to a file.
# ! The print statements print to terminal, not tkinter program
def check_OAuth():
check = False # The user has not checked if they have an OAuth
while check == False: # will loop until the user has entered their OAuth details
oauth_exist = input("Do you have an osu! OAuth token? (y/n): ")
if oauth_exist.lower() == 'n':
# if the user replies 'n' (no), they will be taken to the website below to create OAuth.
print("You need a osu! OAuth Token to access this program")
print("You will be redirected to the osu! website to create an osu! OAuth token")
webbrowser.open_new_tab("https://osu.ppy.sh/home/account/edit#oauth")
continue
elif oauth_exist.lower() == 'y':
# the user has OAuth, retrieve their OAuth details.
get_OAuth()
check = True
else:
# the user input was invalid.
print("Please enter 'y' for YES, and 'n' for NO")
def get_OAuth():
# this function asks the user for their OAuth id, secret and their osu! user ID.
client_id = input("Enter your osu! OAuth client ID: ")
client_secret = input("Enter your osu! OAuth client secret: ")
user_id = input("Enter your osu! ID:")
user_info = [client_id,client_secret,user_id]
print(user_info) # for testing
# FOR TESTING PURPOSES
#if __name__ == "__main__":
# check_OAuth()