バックエンドAPI
This commit is contained in:
184
verify_process.py
Normal file
184
verify_process.py
Normal file
@@ -0,0 +1,184 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
BASE_URL = "http://127.0.0.1:8000"
|
||||
|
||||
payload = {
|
||||
"game_state": {
|
||||
"controlled_powers": None,
|
||||
"daide_port": None,
|
||||
"deadline": 0,
|
||||
"error": [],
|
||||
"game_id": "aGelgNaM_tiPdor5",
|
||||
"map_name": "standard",
|
||||
"message_history": {},
|
||||
"messages": [],
|
||||
"meta_rules": [],
|
||||
"n_controls": 0,
|
||||
"no_rules": [],
|
||||
"note": "",
|
||||
"observer_level": None,
|
||||
"order_history": {},
|
||||
"outcome": [],
|
||||
"phase": "SPRING 1901 MOVEMENT",
|
||||
"phase_abbr": "",
|
||||
"powers": {
|
||||
"AUSTRIA": {
|
||||
"abbrev": "A",
|
||||
"adjust": [],
|
||||
"centers": ["BUD", "TRI", "VIE"],
|
||||
"civil_disorder": 0,
|
||||
"controller": {"1770333163210986": "dummy"},
|
||||
"homes": ["BUD", "TRI", "VIE"],
|
||||
"influence": ["BUD", "VIE", "TRI"],
|
||||
"name": "AUSTRIA",
|
||||
"order_is_set": 0,
|
||||
"orders": {},
|
||||
"retreats": {},
|
||||
"role": "server_type",
|
||||
"tokens": [],
|
||||
"units": ["A BUD", "A VIE", "F TRI"],
|
||||
"vote": "neutral",
|
||||
"wait": True
|
||||
},
|
||||
"ENGLAND": {
|
||||
"abbrev": "E",
|
||||
"adjust": [],
|
||||
"centers": ["EDI", "LON", "LVP"],
|
||||
"civil_disorder": 0,
|
||||
"controller": {"1770333163211038": "dummy"},
|
||||
"homes": ["EDI", "LON", "LVP"],
|
||||
"influence": ["EDI", "LON", "LVP"],
|
||||
"name": "ENGLAND",
|
||||
"order_is_set": 0,
|
||||
"orders": {},
|
||||
"retreats": {},
|
||||
"role": "server_type",
|
||||
"tokens": [],
|
||||
"units": ["F EDI", "F LON", "A LVP"],
|
||||
"vote": "neutral",
|
||||
"wait": True
|
||||
},
|
||||
"FRANCE": {
|
||||
"abbrev": "F",
|
||||
"adjust": [],
|
||||
"centers": ["BRE", "MAR", "PAR"],
|
||||
"civil_disorder": 0,
|
||||
"controller": {"1770333163211088": "dummy"},
|
||||
"homes": ["BRE", "MAR", "PAR"],
|
||||
"influence": ["BRE", "MAR", "PAR"],
|
||||
"name": "FRANCE",
|
||||
"order_is_set": 0,
|
||||
"orders": {},
|
||||
"retreats": {},
|
||||
"role": "server_type",
|
||||
"tokens": [],
|
||||
"units": ["F BRE", "A MAR", "A PAR"],
|
||||
"vote": "neutral",
|
||||
"wait": True
|
||||
},
|
||||
"GERMANY": {
|
||||
"abbrev": "G",
|
||||
"adjust": [],
|
||||
"centers": ["BER", "KIE", "MUN"],
|
||||
"civil_disorder": 0,
|
||||
"controller": {"1770333163211135": "dummy"},
|
||||
"homes": ["BER", "KIE", "MUN"],
|
||||
"influence": ["KIE", "BER", "MUN"],
|
||||
"name": "GERMANY",
|
||||
"order_is_set": 0,
|
||||
"orders": {},
|
||||
"retreats": {},
|
||||
"role": "server_type",
|
||||
"tokens": [],
|
||||
"units": ["F KIE", "A BER", "A MUN"],
|
||||
"vote": "neutral",
|
||||
"wait": True
|
||||
},
|
||||
"ITALY": {
|
||||
"abbrev": "I",
|
||||
"adjust": [],
|
||||
"centers": ["NAP", "ROM", "VEN"],
|
||||
"civil_disorder": 0,
|
||||
"controller": {"1770333163211181": "dummy"},
|
||||
"homes": ["NAP", "ROM", "VEN"],
|
||||
"influence": ["NAP", "ROM", "VEN"],
|
||||
"name": "ITALY",
|
||||
"order_is_set": 0,
|
||||
"orders": {},
|
||||
"retreats": {},
|
||||
"role": "server_type",
|
||||
"tokens": [],
|
||||
"units": ["F NAP", "A ROM", "A VEN"],
|
||||
"vote": "neutral",
|
||||
"wait": True
|
||||
},
|
||||
"RUSSIA": {
|
||||
"abbrev": "R",
|
||||
"adjust": [],
|
||||
"centers": ["MOS", "SEV", "STP", "WAR"],
|
||||
"civil_disorder": 0,
|
||||
"controller": {"1770333163211226": "dummy"},
|
||||
"homes": ["MOS", "SEV", "STP", "WAR"],
|
||||
"influence": ["WAR", "MOS", "SEV", "STP"],
|
||||
"name": "RUSSIA",
|
||||
"order_is_set": 0,
|
||||
"orders": {},
|
||||
"retreats": {},
|
||||
"role": "server_type",
|
||||
"tokens": [],
|
||||
"units": ["A WAR", "A MOS", "F SEV", "F STP/SC"],
|
||||
"vote": "neutral",
|
||||
"wait": True
|
||||
},
|
||||
"TURKEY": {
|
||||
"abbrev": "T",
|
||||
"adjust": [],
|
||||
"centers": ["ANK", "CON", "SMY"],
|
||||
"civil_disorder": 0,
|
||||
"controller": {"1770333163211272": "dummy"},
|
||||
"homes": ["ANK", "CON", "SMY"],
|
||||
"influence": ["ANK", "CON", "SMY"],
|
||||
"name": "TURKEY",
|
||||
"order_is_set": 0,
|
||||
"orders": {},
|
||||
"retreats": {},
|
||||
"role": "server_type",
|
||||
"tokens": [],
|
||||
"units": ["F ANK", "A CON", "A SMY"],
|
||||
"vote": "neutral",
|
||||
"wait": True
|
||||
}
|
||||
},
|
||||
"registration_password": None,
|
||||
"result_history": {},
|
||||
"role": "server_type",
|
||||
"rules": ["NO_DEADLINE", "CD_DUMMIES", "ALWAYS_WAIT", "SOLITAIRE", "NO_PRESS", "IGNORE_ERRORS", "POWER_CHOICE"],
|
||||
"state_history": {},
|
||||
"status": "forming",
|
||||
"timestamp_created": 1770333163210884,
|
||||
"victory": [18],
|
||||
"win": 18,
|
||||
"zobrist_hash": 1919110489198082600
|
||||
},
|
||||
"orders": {
|
||||
"FRANCE": ["A MAR - PIE", "A PAR - BUR"]
|
||||
}
|
||||
}
|
||||
|
||||
try:
|
||||
resp = requests.post(f"{BASE_URL}/calculate/process", json=payload)
|
||||
print(f"Status Code: {resp.status_code}")
|
||||
if resp.status_code == 200:
|
||||
result = resp.json()
|
||||
print(f"New Phase: {result['game_state']['phase']}")
|
||||
print(f"France Units: {result['game_state']['powers']['FRANCE']['units']}")
|
||||
# Check order history
|
||||
history = result['game_state']['order_history']
|
||||
print(f"Order History Keys: {list(history.keys())}")
|
||||
if 'SPRING 1901 MOVEMENT' in history:
|
||||
print(f"France Spring 1901 Orders: {history['SPRING 1901 MOVEMENT'].get('FRANCE')}")
|
||||
else:
|
||||
print(f"Error Response: {resp.text}")
|
||||
except Exception as e:
|
||||
print(f"Exception: {str(e)}")
|
||||
Reference in New Issue
Block a user