-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
28 lines (22 loc) · 796 Bytes
/
Copy pathconfig.py
File metadata and controls
28 lines (22 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
config.py — IBM Quantum credentials loader
Reads the API key from ../apikey.json (one level above this file).
That file is intentionally kept OUTSIDE the Quantum-Chess folder and is
listed in .gitignore so it never gets committed or shared accidentally.
Available backends on this account:
ibm_fez (default)
ibm_marrakesh
ibm_kingston
Override from the command line without editing this file:
python main.py --mode ibm --backend ibm_marrakesh
"""
import json
import os
_key_file = os.path.join(os.path.dirname(__file__), '..', 'apikey.json')
try:
with open(_key_file) as _f:
_data = json.load(_f)
IBM_QUANTUM_TOKEN = _data.get("apikey", "")
except (FileNotFoundError, KeyError, json.JSONDecodeError):
IBM_QUANTUM_TOKEN = ""
IBM_BACKEND = "ibm_fez"