Skip to content

Commit ebc7d27

Browse files
committed
update
1 parent b7091dc commit ebc7d27

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.automations/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"comment": "DO NOT MODIFY THIS FILE!",
3+
"url": "https://script.google.com/macros/s/AKfycbwmOxM6cXKcNPBatM8zgJEoCSotUXRhN5XVgMXwf20ukMJcNMzDBoQXoNfIpUrL0QFpfg/exec"
4+
}

.automations/give-student-credit.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
import subprocess
88
import sys
99
from datetime import datetime
10+
from pathlib import Path
1011
from urllib.request import Request, urlopen
1112
from urllib.error import URLError
1213
import argparse
1314

15+
CONFIG_PATH = Path(__file__).resolve().parent / "config.json"
16+
1417

1518
def git_config(key):
1619
try:
@@ -29,7 +32,6 @@ def git_config(key):
2932

3033

3134
def main():
32-
import argparse
3335

3436
parser = argparse.ArgumentParser()
3537
parser.add_argument("--event", default="agent", help="Event type (default: agent)")
@@ -57,7 +59,9 @@ def main():
5759
"date": current_date,
5860
}
5961
]
60-
url = "https://script.google.com/macros/s/AKfycbzDomyYQ1zsHy_eDOjyK7D48xpMUti2MCna3H4mvjkzZ42dnJTKQHUrRfoRtVFLd5Ia/exec"
62+
with open(CONFIG_PATH, "r", encoding="utf-8") as f:
63+
config = json.load(f)
64+
url = config["url"]
6165
body = json.dumps(payload).encode("utf-8")
6266
req = Request(
6367
url, data=body, method="POST", headers={"Content-Type": "application/json"}

0 commit comments

Comments
 (0)