15 lines
720 B
Python
15 lines
720 B
Python
import subprocess
|
|
code='''import asyncio,httpx
|
|
from app import providers,provider_headers,admission_ids
|
|
async def main():
|
|
print('admitted',sorted(admission_ids(providers())))
|
|
async with httpx.AsyncClient(timeout=20) as c:
|
|
for p in providers().values():
|
|
for endpoint in ('/object_info/ApplyVDNH3','/object_info','/queue'):
|
|
r=await c.get(p.base_url+endpoint,headers=provider_headers(p))
|
|
d=r.json() if r.status_code==200 else {}
|
|
print(p.id,endpoint,r.status_code,('ApplyVDNH3' in d) if 'object' in endpoint else {k:len(d.get(k,[])) for k in ('queue_running','queue_pending')})
|
|
asyncio.run(main())
|
|
'''
|
|
print(subprocess.check_output(['docker','exec','huobao-vdn-normalizer','python','-c',code],text=True))
|