2018-02-19 23:42:40 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
2019-10-07 09:23:44 +02:00
|
|
|
import sys
|
2018-02-19 23:42:40 +01:00
|
|
|
from ovh import ovh
|
|
|
|
|
2019-10-07 09:23:44 +02:00
|
|
|
if len(sys.argv) != 2:
|
|
|
|
print('usage: {} <domain>'.format(sys.argv[0]))
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
domain = sys.argv[1]
|
2018-02-19 23:42:40 +01:00
|
|
|
|
|
|
|
client = ovh.Client()
|
|
|
|
|
|
|
|
ck = client.new_consumer_key_request()
|
|
|
|
ck.add_rules(ovh.API_READ_WRITE_SAFE, '/domain/zone/%s/record' % domain)
|
|
|
|
ck.add_rules(ovh.API_READ_WRITE_SAFE, '/domain/zone/%s/record/*' % domain)
|
|
|
|
ck.add_rules(ovh.API_READ_WRITE_SAFE, '/domain/zone/%s/refresh' % domain)
|
|
|
|
|
|
|
|
validation = ck.request()
|
|
|
|
|
|
|
|
print("Please visit %s to authenticate" % validation['validationUrl'])
|
|
|
|
input("and press Enter to continue...")
|
|
|
|
|
|
|
|
# Print nice welcome message
|
|
|
|
print("'consumerKey' is '%s'" % validation['consumerKey'])
|