cookies
This commit is contained in:
@@ -290,21 +290,20 @@ async def update_cookies(
|
||||
cookie_data: CookieUpdate
|
||||
):
|
||||
try:
|
||||
# see if cookie file exists
|
||||
if not os.path.exists('cookies') and os.path.exists('cookies/tcg_cookies.json'):
|
||||
logger.info("Cannot find cookies")
|
||||
# Create cookies directory if it doesn't exist
|
||||
os.makedirs('cookies', exist_ok=True)
|
||||
|
||||
# Save cookies with timestamp
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
cookie_path = f'cookies/tcg_cookies.json'
|
||||
cookie_path = 'cookies/tcg_cookies.json'
|
||||
|
||||
# Save new cookies
|
||||
with open(cookie_path, 'w') as f:
|
||||
json.dump(cookie_data.cookies, f, indent=2)
|
||||
|
||||
# Update the "latest" cookies file
|
||||
with open('cookies/tcg_cookies_latest.json', 'w') as f:
|
||||
json.dump(cookie_data.cookies, f, indent=2)
|
||||
|
||||
return {"message": "Cookies updated successfully"}
|
||||
|
||||
except Exception as e:
|
||||
|
Reference in New Issue
Block a user