31 lines
934 B
Python
31 lines
934 B
Python
|
|
import requests
|
|
import json
|
|
import config
|
|
|
|
url = f"https://cloud-fat.d-robotics.cc/api/dcloudResourceApi/consumptions"
|
|
params = {
|
|
"page": 1,
|
|
"pageSize": 50,
|
|
"instanceName": "验证01"
|
|
}
|
|
headers = {
|
|
"Accept": "application/json, text/plain, */*",
|
|
"Authorization": config.CLOUD_AUTH_TOKEN,
|
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36",
|
|
}
|
|
|
|
print(f"Requesting URL: {url}")
|
|
resp = requests.get(url, params=params, headers=headers)
|
|
print(f"Status Code: {resp.status_code}")
|
|
try:
|
|
data = resp.json()
|
|
print(f"Status in JSON: {data.get('status')}")
|
|
print(f"Data content: {data.get('data')}")
|
|
items = data.get("data", {}).get("items", [])
|
|
for item in items:
|
|
print(f"- {item.get('instanceName')}")
|
|
except Exception as e:
|
|
print(f"Error parsing JSON: {e}")
|
|
print(f"Raw Response: {resp.text[:500]}")
|