Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import pycurl
- import socket
- import time
- from twindb_cloudflare.twindb_cloudflare import CloudFlare, CloudFlareException
- from StringIO import StringIO
- from urllib import urlencode
- import requests
- import simplejson as json
- import time
- # Cloudflare API information found in your account
- CLOUDFLARE_EMAIL = ""
- CLOUDFLARE_AUTH_KEY = ""
- cf = CloudFlare(CLOUDFLARE_EMAIL, CLOUDFLARE_AUTH_KEY)
- # Create Vultr VPS using default values
- # url = 'https://api.vultr.com/v1/server/create'
- # headers = {'API-Key': 'Y3TLTIO5VMINWCH3OYW2URDLYA6FUOKYVSZQ'}
- # payload = {'DCID': '2', 'VPSPLANID': '201', 'OSID': '252', 'enable_ipv6': 'yes', 'SSHKEYID': '57d133b966663', 'FIREWALLGROUPID': 'f3e4770c', 'label': 'letsnotbestupid', 'hostname': 'testlol'}
- # r = requests.post(url, headers=headers, data=payload).json()
- # SUBID2= r.values()[0]
- # print(SUBID2)
- # time.sleep(90)
- # SUBID = repr(SUBID)
- url = "https://api.vultr.com/v1/server/list_ipv4"
- querystring = {"SUBID":"12056844"}
- headers = {
- 'API-Key': "",
- 'Cache-Control': "no-cache"
- }
- response = requests.get(url, headers=headers, params=querystring)
- data = response.json()
- ipv4 = data["12056844"][0]
- print(ipv4)
- url = "https://api.vultr.com/v1/server/list_ipv6"
- querystring = {"SUBID":"12056844"}
- headers = {
- 'API-Key': "",
- 'Cache-Control': "no-cache"
- }
- response = requests.get(url, headers=headers, params=querystring)
- data = response.json()
- ipv6 = data['12056844'][1]
- print(ipv6)
- # SUBID = '12056844'
- # url2 = "https://api.vultr.com/v1/server/list_ipv4"
- #
- #
- #
- # headers = {
- # 'API-Key': "",
- # 'Cache-Control': "no-cache"
- # }
- # payload = {'SUBID': '12056844'}
- # response = requests.get(url2, headers=headers, data=payload).json()
- # ipv4 = response.values()[0]
- # ipv4 = json.dumps(response, indent=3)
- # print type(response)
- # print response.keys()
- # res2 = response['ip']
- # print(res2)
- # vultrIPV4 = response.values()[0]
- # print(vultrIPV4)
- # url3 = "https://api.vultr.com/v1/server/list_ipv6?SUBID="+SUBID
- #
- # querystring = {}
- #
- # headers = {
- # 'API-Key': "",
- # 'Cache-Control': "no-cache"
- # }
- # payload = {'SUBID': SUBID}
- # response = requests.request("GET", url3, headers=headers, data=payload).json()
- #
- # vultrIPV6 = r.values()[1]
- # print(vultrIPV6)
- #
- # domain = str(raw_input("What is the domain name?"))
- # ipv4 = str (raw_input("What is the IPV4 address of the server?"))
- # ipv6 = str (raw_input("What is the IPV6 address of the server?"))
- #
- #
- # cf.create_dns_record('@', domain, ipv4)
- # cf.create_dns_record('www', domain, ipv4)
- # cf.create_dns_record('@', domain, ipv6, record_type="AAAA")
- # cf.create_dns_record('www', domain, ipv6, record_type="AAAA")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement