use BASE var in bulk_create output

This commit is contained in:
jomo 2024-02-01 02:03:02 +01:00
parent ec64e81829
commit 703a210f1e

View file

@ -4,7 +4,7 @@ import sys
import requests import requests
BASE = "https://in.ccc.ac/api" BASE = "https://in.ccc.ac"
COUNT = 0 COUNT = 0
START_ID = 1 START_ID = 1
@ -12,7 +12,7 @@ START_ID = 1
session = requests.Session() session = requests.Session()
# session.auth = (":)", ":)") # session.auth = (":)", ":)")
res = session.get(f"{BASE}/items") res = session.get(f"{BASE}/api/items")
res.raise_for_status() res.raise_for_status()
ids = res.json().keys() ids = res.json().keys()
kiste_ids = {int(i.lstrip("K")) for i in ids if i.startswith("K") and i != "K"} kiste_ids = {int(i.lstrip("K")) for i in ids if i.startswith("K") and i != "K"}
@ -42,6 +42,6 @@ for i in new_ids:
"note": "Bitte Name, Ort, Inhalt eintragen", "note": "Bitte Name, Ort, Inhalt eintragen",
"hidden": False, "hidden": False,
} }
res = session.put(f"{BASE}/items/{j['id']}", json=j) res = session.put(f"{BASE}/api/items/{j['id']}", json=j)
res.raise_for_status() res.raise_for_status()
print(f"{j['id']},https://in.ccc.ac/form.html?id={j['id']}") print(f"{j['id']},{BASE}/form.html?id={j['id']}")