39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
import urllib.request
|
|
import json
|
|
import ssl
|
|
|
|
url = "https://127.0.0.1:54285/exa.language_server_pb.LanguageServerService/GetDiagnostics"
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
req = urllib.request.Request(url, data=json.dumps({}).encode(), headers={
|
|
'Content-Type': 'application/json',
|
|
'token': '5e529def-51fe-4bde-9955-5eca7299bd89'
|
|
})
|
|
|
|
try:
|
|
with urllib.request.urlopen(req, context=ctx) as response:
|
|
res = json.loads(response.read().decode('utf-8'))
|
|
recent = res.get('recentTrajectories', [])
|
|
print(f"HTTPS Total: {len(recent)}")
|
|
for r in recent:
|
|
print(r.get('googleAgentId'), r.get('lastModifiedTime'), r.get('status'))
|
|
|
|
except Exception as e:
|
|
print(f"HTTPS failed: {e}")
|
|
url = url.replace('https', 'http')
|
|
req = urllib.request.Request(url, data=json.dumps({}).encode(), headers={
|
|
'Content-Type': 'application/json',
|
|
'token': '5e529def-51fe-4bde-9955-5eca7299bd89'
|
|
})
|
|
try:
|
|
with urllib.request.urlopen(req) as response:
|
|
res = json.loads(response.read().decode('utf-8'))
|
|
recent = res.get('recentTrajectories', [])
|
|
print(f"HTTP Total: {len(recent)}")
|
|
for r in recent:
|
|
print(r.get('googleAgentId'), r.get('lastModifiedTime'), r.get('status'))
|
|
except Exception as e2:
|
|
print(f"HTTP failed: {e2}")
|