SignalLayer Labs commited on
Commit
e7afdfb
·
unverified ·
2 Parent(s): e699c201ec9e51

Merge pull request #5 from SignalLayerLabs/fix/deployment-verifier-agent

Browse files
Files changed (1) hide show
  1. scripts/verify_deployment.py +10 -3
scripts/verify_deployment.py CHANGED
@@ -13,9 +13,16 @@ args = parser.parse_args()
13
  revision = subprocess.check_output(['git', 'rev-parse', 'HEAD'], text=True).strip()
14
  backend = 'https://italianhype-blum.hf.space'
15
  site = 'https://blum.signallayerlabs.workers.dev'
 
 
 
 
 
 
 
16
 
17
  def get_json(origin, path):
18
- response = urllib.request.urlopen(origin+path, timeout=15)
19
  if 'application/json' not in response.headers.get('Content-Type', ''):
20
  raise ValueError('Expected a JSON API response: '+path)
21
  return json.load(response)
@@ -47,12 +54,12 @@ if not args.backend_only:
47
  if not isinstance(payload, dict): raise SystemExit('Invalid snapshot: '+path)
48
  print('Verified JSON snapshot', path, flush=True)
49
  try:
50
- urllib.request.urlopen(urllib.request.Request(site+'/api/ascent/run', data=b'{}', method='POST'), timeout=15)
51
  raise SystemExit('Public research mutation was unexpectedly allowed.')
52
  except urllib.error.HTTPError as exc:
53
  if exc.code != 405: raise
54
  for path in ['/brain/', '/training-ground/', '/paper-trading/', '/alpha/', '/evolution/']:
55
- response = urllib.request.urlopen(site+path, timeout=15)
56
  if response.status != 200 or 'text/html' not in response.headers.get('Content-Type', ''):
57
  raise SystemExit('Product page unavailable: '+path)
58
  print('Cloudflare pages, live API snapshots and write protection verified.', flush=True)
 
13
  revision = subprocess.check_output(['git', 'rev-parse', 'HEAD'], text=True).strip()
14
  backend = 'https://italianhype-blum.hf.space'
15
  site = 'https://blum.signallayerlabs.workers.dev'
16
+ verification_headers = {
17
+ 'User-Agent': 'BLUM-Deployment-Verification/2.2.0 (+https://github.com/SignalLayerLabs/Blum)',
18
+ }
19
+
20
+ def request(url, **kwargs):
21
+ # Identify the maintained verifier explicitly; workers.dev rejects Python's default agent.
22
+ return urllib.request.Request(url, headers=verification_headers, **kwargs)
23
 
24
  def get_json(origin, path):
25
+ response = urllib.request.urlopen(request(origin+path), timeout=15)
26
  if 'application/json' not in response.headers.get('Content-Type', ''):
27
  raise ValueError('Expected a JSON API response: '+path)
28
  return json.load(response)
 
54
  if not isinstance(payload, dict): raise SystemExit('Invalid snapshot: '+path)
55
  print('Verified JSON snapshot', path, flush=True)
56
  try:
57
+ urllib.request.urlopen(request(site+'/api/ascent/run', data=b'{}', method='POST'), timeout=15)
58
  raise SystemExit('Public research mutation was unexpectedly allowed.')
59
  except urllib.error.HTTPError as exc:
60
  if exc.code != 405: raise
61
  for path in ['/brain/', '/training-ground/', '/paper-trading/', '/alpha/', '/evolution/']:
62
+ response = urllib.request.urlopen(request(site+path), timeout=15)
63
  if response.status != 200 or 'text/html' not in response.headers.get('Content-Type', ''):
64
  raise SystemExit('Product page unavailable: '+path)
65
  print('Cloudflare pages, live API snapshots and write protection verified.', flush=True)