From f56a5538618c78fa973776c9e2874c66b500ba76 Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Tue, 12 Nov 2024 16:49:10 +0100 Subject: [PATCH] Updated user agent --- Update Missing/update_missing.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Update Missing/update_missing.py b/Update Missing/update_missing.py index 7bb8780..7910d61 100755 --- a/Update Missing/update_missing.py +++ b/Update Missing/update_missing.py @@ -43,6 +43,7 @@ import requests import sys import os +import io import re from datetime import date,datetime @@ -108,7 +109,7 @@ for line in comiclist: comiclist.close() print("py: Querying ComicVine for new issues") -headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'} +headers = {'User-Agent': 'CVIssueCount/ (https://gitea.baerentsen.space/FrederikBaerentsen/ComicRack_Scripts/src/branch/master/CVIssueCount)'} new_comics_cont = 0 old_comics_cont = 0 updated_comics_cont = 0 @@ -205,8 +206,8 @@ deleted_file.close() print("py: Writing database to file") -outfile = open(out_file,"wb") -outfile.write(("Missing;" + end_date + "\n").encode()) +outfile = io.open(out_file,"w",encoding="utf8") +outfile.write(("Missing;" + end_date + "\n")) for volume_id in sorted(comics): issues = "" @@ -215,7 +216,7 @@ for volume_id in sorted(comics): issues += str(issue_id) + "," nums += comics[volume_id][issue_id] + "," issues = issues[:-1] - outfile.write((str(volume_id) + ";" + issues + ";" + nums + "\n").encode()) + outfile.write((str(volume_id) + ";" + issues + ";" + nums + "\n")) outfile.close()