<reponame>gggin/RaySync<filename>VdiskSDK-Python/vdisk_Oauth.py
# For both Python 2.x and 3.x
try:
    read_input = raw_input
except NameError:
    read_input = input
###############################################

import vdisk

app_key = '2517708176'
app_secret = '<KEY>'
callback_url = 'http://172.16.17.32/'

x = vdisk.OAuth2(app_key, app_secret, callback_url);


import platform
if cmp(platform.system(), "Windows")==0 :
    import webbrowser
    webbrowser.open(x.authorize())



accepted = 'n'
while accepted.lower() == 'n':
    accepted = read_input('Have you authorized me? (y/n) ')
oauth_verifier = read_input('What is the PIN? ')


print x.access_token('authorization_code', oauth_verifier)



# For both Python 2.x and 3.x
try:
    read_input = raw_input
except NameError:
    read_input = input
###############################################

import vdisk

app_key = '2517708176'
app_secret = '<KEY>'
callback_url = 'http://172.16.17.32/'

x = vdisk.OAuth2(app_key, app_secret, callback_url);


import platform
if cmp(platform.system(), "Windows")==0 :
    import webbrowser
    webbrowser.open(x.authorize())



accepted = 'n'
while accepted.lower() == 'n':
    accepted = read_input('Have you authorized me? (y/n) ')
oauth_verifier = read_input('What is the PIN? ')


print x.access_token('authorization_code', oauth_verifier)
# For both Python 2.x and 3.x ###############################################