Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit 9e275fa

Browse files
committed
Save tickets
1 parent c1ccf52 commit 9e275fa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/tickets2db.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import datetime
55
import hashlib
66
import os
7+
import pathlib
78
import pickle
9+
import shutil
810
import stat
911
import sys
1012
import time
@@ -16,6 +18,8 @@
1618
SLEEP_MINUTES = 5
1719

1820
errors_path = os.path.join(request.folder, "errors")
21+
tickets_path = pathlib.Path(request.folder, "books", "tickets")
22+
tickets_path.mkdir(exist_ok=True)
1923

2024
if os.environ["WEB2PY_CONFIG"] == "production":
2125
db_string = os.environ["DBURL"]
@@ -75,6 +79,6 @@
7579
)
7680
sess.execute(newtb)
7781
sess.commit()
78-
os.unlink(filename)
82+
shutil.move(filename, tickets_path)
7983

8084
time.sleep(SLEEP_MINUTES * 60)

0 commit comments

Comments
 (0)