v2: ID verification by state, 15 photos/5 albums, 20 quick replies, logo, mobile polish
This commit is contained in:
40
deploy/test-onsethost-token.py
Normal file
40
deploy/test-onsethost-token.py
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import paramiko
|
||||
|
||||
PASS = "Bbt9115xty9176!"
|
||||
ACCOUNT = "2599c23bbb1255dbb73e8d34b4115fda"
|
||||
TUNNEL = "03079a26-f14c-4622-b463-ba54a24f7472"
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("10.10.0.10", username="localadministrator", password=PASS, timeout=30)
|
||||
_, o, e = c.exec_command(
|
||||
"grep CLOUDFLARE_API_TOKEN /home/localadministrator/coder/onsethost/.env.local",
|
||||
timeout=20,
|
||||
)
|
||||
o.channel.recv_exit_status()
|
||||
line = (o.read() + e.read()).decode().strip()
|
||||
tok = line.split("=", 1)[1].strip()
|
||||
c.close()
|
||||
|
||||
print("token prefix:", tok[:12], "len:", len(tok))
|
||||
|
||||
for path in [
|
||||
"/user/tokens/verify",
|
||||
f"/accounts/{ACCOUNT}/cfd_tunnel/{TUNNEL}/configurations",
|
||||
"/zones?name=exposedgays.com",
|
||||
]:
|
||||
req = urllib.request.Request(
|
||||
f"https://api.cloudflare.com/client/v4{path}",
|
||||
headers={"Authorization": f"Bearer {tok}", "Content-Type": "application/json"},
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
data = json.load(r)
|
||||
print(path, "OK", data.get("success"), "errors=", data.get("errors"))
|
||||
except urllib.error.HTTPError as e:
|
||||
err = json.loads(e.read().decode())
|
||||
print(path, e.code, err.get("errors"))
|
||||
Reference in New Issue
Block a user