v2: ID verification by state, 15 photos/5 albums, 20 quick replies, logo, mobile polish
This commit is contained in:
62
deploy/godaddy-ns-to-cf.py
Normal file
62
deploy/godaddy-ns-to-cf.py
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Delegate exposedgays.com from GoDaddy to Cloudflare nameservers."""
|
||||
import json
|
||||
import re
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
GODADDY_KEY = "2wYVpc3VT4_Gi9AsNqzJ6BtSfNz6nLDuo"
|
||||
GODADDY_SECRET = "NvC3qexGAU7Rd5QExUTH6z"
|
||||
DOMAIN = "exposedgays.com"
|
||||
GD = "https://api.godaddy.com/v1"
|
||||
|
||||
|
||||
def gd(path, method="GET", body=None):
|
||||
req = urllib.request.Request(
|
||||
GD + path,
|
||||
data=json.dumps(body).encode() if body is not None else None,
|
||||
method=method,
|
||||
headers={
|
||||
"Authorization": f"sso-key {GODADDY_KEY}:{GODADDY_SECRET}",
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
},
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=45) as r:
|
||||
raw = r.read().decode()
|
||||
return r.status, json.loads(raw) if raw else {}
|
||||
except urllib.error.HTTPError as e:
|
||||
raw = e.read().decode()
|
||||
try:
|
||||
return e.code, json.loads(raw)
|
||||
except Exception:
|
||||
return e.code, {"raw": raw[:800]}
|
||||
|
||||
|
||||
def main():
|
||||
code, domain = gd(f"/domains/{DOMAIN}")
|
||||
print(f"Domain GET HTTP {code}")
|
||||
if code == 200:
|
||||
print(f" Current NS: {domain.get('nameServers')}")
|
||||
print(f" Status: {domain.get('status')}")
|
||||
|
||||
# Show what we'd set — caller passes NS via env or args in wrapper
|
||||
import sys
|
||||
if len(sys.argv) < 2:
|
||||
print("\nUsage: godaddy-ns-to-cf.py <ns1> <ns2> [ns3...]")
|
||||
return 1
|
||||
|
||||
nameservers = sys.argv[1:]
|
||||
print(f"\nPATCH nameservers -> {nameservers}")
|
||||
code, res = gd(f"/domains/{DOMAIN}", "PATCH", {"nameServers": nameservers})
|
||||
print(f"HTTP {code}: {json.dumps(res, indent=2)}")
|
||||
|
||||
code, domain = gd(f"/domains/{DOMAIN}")
|
||||
if code == 200:
|
||||
print(f"\nAfter PATCH NS: {domain.get('nameServers')}")
|
||||
return 0 if code == 200 else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user