27 lines
607 B
Python
Executable File
27 lines
607 B
Python
Executable File
# -*- encoding: utf-8 -*-
|
|
###
|
|
try:
|
|
input = raw_input
|
|
except NameError:
|
|
pass
|
|
|
|
import ovh
|
|
import json
|
|
|
|
# create a client using configuration from ovh.conf file
|
|
client = ovh.Client()
|
|
|
|
# Request RO, /me API access
|
|
ck = client.new_consumer_key_request()
|
|
ck.add_recursive_rules(ovh.API_READ_ONLY, "/")
|
|
|
|
# Request token
|
|
validation = ck.request()
|
|
|
|
print("Please visit %s to authenticate" % validation['validationUrl'])
|
|
input("and press Enter to continue...")
|
|
|
|
# Print nice welcome message
|
|
print("Welcome", client.get('/me')['firstname'])
|
|
print("Btw, your 'consumerKey' is '%s'" % validation['consumerKey'])
|