v0.1.1
All checks were successful
Build and Deploy Docker Image / build-and-push (push) Successful in 3m56s
All checks were successful
Build and Deploy Docker Image / build-and-push (push) Successful in 3m56s
-- added automativ queue reconenction (querying for queues to join from server)
This commit is contained in:
@@ -5,7 +5,7 @@ import requests
|
||||
|
||||
# Global var from env
|
||||
QUANTUM_BACKEND_URL = os.getenv(
|
||||
"QUANTUM_BACKEND_URL", os.environ["QUNATUM_BACKEND_URL"]
|
||||
"QUANTUM_BACKEND_URL", os.environ["QUANTUM_BACKEND_URL"]
|
||||
)
|
||||
|
||||
|
||||
@@ -25,19 +25,29 @@ def get_or_create_device_by_name(
|
||||
Raises:
|
||||
requests.RequestException: If the request fails
|
||||
"""
|
||||
url = f"{QUANTUM_BACKEND_URL}/machine/"
|
||||
|
||||
url = f"{QUANTUM_BACKEND_URL}/machine"
|
||||
payload = {"system_name": system_name, "max_qubits": max_qubits}
|
||||
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": f"Bearer {access_token}",
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Connection": "keep-alive",
|
||||
"Referer": url,
|
||||
"Host": "quantum-backend.deowl.ru",
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(url, json=payload, headers=headers)
|
||||
print(response.content)
|
||||
print(response.headers)
|
||||
print(headers)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except requests.RequestException as e:
|
||||
except Exception as e:
|
||||
print(f"Failed to get or create device: {e}")
|
||||
raise Exception(f"Failed to get or create device: {e}") from e
|
||||
|
||||
|
||||
@@ -60,6 +70,11 @@ def get_device_by_id(system_id: int, access_token) -> Dict[str, Any]:
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": f"Bearer {access_token}",
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Connection": "keep-alive",
|
||||
"Referer": url,
|
||||
"Host": "quantum-backend.deowl.ru",
|
||||
}
|
||||
|
||||
try:
|
||||
@@ -103,6 +118,11 @@ def update_device_data(
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": f"Bearer {access_token}",
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Connection": "keep-alive",
|
||||
"Referer": url,
|
||||
"Host": "quantum-backend.deowl.ru",
|
||||
}
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user