Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.73 KB | None | 0 0
  1. #!/usr/bin/python
  2. import pycurl
  3. import socket
  4. import time
  5. from twindb_cloudflare.twindb_cloudflare import CloudFlare, CloudFlareException
  6. from StringIO import StringIO
  7. from urllib import urlencode
  8. import requests
  9. import simplejson as json
  10. import time
  11. # Cloudflare API information found in your account
  12.  
  13. CLOUDFLARE_EMAIL = ""
  14. CLOUDFLARE_AUTH_KEY = ""
  15. cf = CloudFlare(CLOUDFLARE_EMAIL, CLOUDFLARE_AUTH_KEY)
  16.  
  17.  
  18. # Create Vultr VPS using default values
  19.  
  20. # url = 'https://api.vultr.com/v1/server/create'
  21. # headers = {'API-Key': 'Y3TLTIO5VMINWCH3OYW2URDLYA6FUOKYVSZQ'}
  22. # payload = {'DCID': '2', 'VPSPLANID': '201', 'OSID': '252', 'enable_ipv6': 'yes',  'SSHKEYID': '57d133b966663', 'FIREWALLGROUPID': 'f3e4770c', 'label': 'letsnotbestupid', 'hostname': 'testlol'}
  23. # r = requests.post(url, headers=headers, data=payload).json()
  24. # SUBID2= r.values()[0]
  25. # print(SUBID2)
  26.  
  27. # time.sleep(90)
  28.  
  29. # SUBID = repr(SUBID)
  30.  
  31. url = "https://api.vultr.com/v1/server/list_ipv4"
  32.  
  33. querystring = {"SUBID":"12056844"}
  34.  
  35. headers = {
  36.     'API-Key': "",
  37.     'Cache-Control': "no-cache"
  38.  
  39.     }
  40.  
  41. response = requests.get(url, headers=headers, params=querystring)
  42.  
  43. data = response.json()
  44. ipv4 = data["12056844"][0]
  45. print(ipv4)
  46.  
  47. url = "https://api.vultr.com/v1/server/list_ipv6"
  48.  
  49. querystring = {"SUBID":"12056844"}
  50.  
  51. headers = {
  52.     'API-Key': "",
  53.     'Cache-Control': "no-cache"
  54.  
  55.     }
  56.  
  57. response = requests.get(url, headers=headers, params=querystring)
  58.  
  59. data = response.json()
  60. ipv6 = data['12056844'][1]
  61. print(ipv6)
  62.  
  63. # SUBID = '12056844'
  64. # url2 = "https://api.vultr.com/v1/server/list_ipv4"
  65. #
  66. #
  67. #
  68. # headers = {
  69. #     'API-Key': "",
  70. #     'Cache-Control': "no-cache"
  71. #     }
  72. # payload = {'SUBID': '12056844'}
  73. # response = requests.get(url2, headers=headers, data=payload).json()
  74. # ipv4 = response.values()[0]
  75.  
  76.  
  77.  
  78. # ipv4 = json.dumps(response, indent=3)
  79. # print type(response)
  80. # print response.keys()
  81. # res2 = response['ip']
  82. # print(res2)
  83. # vultrIPV4 = response.values()[0]
  84. # print(vultrIPV4)
  85.  
  86.  
  87. # url3 = "https://api.vultr.com/v1/server/list_ipv6?SUBID="+SUBID
  88. #
  89. # querystring = {}
  90. #
  91. # headers = {
  92. #     'API-Key': "",
  93. #     'Cache-Control': "no-cache"
  94. #     }
  95. # payload = {'SUBID': SUBID}
  96. # response = requests.request("GET", url3, headers=headers, data=payload).json()
  97. #
  98. # vultrIPV6 = r.values()[1]
  99. # print(vultrIPV6)
  100. #
  101. # domain = str(raw_input("What is the domain name?"))
  102. # ipv4 = str (raw_input("What is the IPV4 address of the server?"))
  103. # ipv6 = str (raw_input("What is the IPV6 address of the server?"))
  104. #
  105. #
  106. # cf.create_dns_record('@', domain, ipv4)
  107. # cf.create_dns_record('www', domain, ipv4)
  108. # cf.create_dns_record('@', domain, ipv6, record_type="AAAA")
  109. # cf.create_dns_record('www', domain, ipv6, record_type="AAAA")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement