1
0
Fork 0
mirror of https://github.com/Jonny007-MKD/OTR-SaneRename synced 2024-05-02 20:54:04 +02:00

Catch exception when downloading EPG

This commit is contained in:
Jonny007-MKD 2020-04-04 22:08:01 +02:00
parent a5b6136bf3
commit e48cc4a690

View file

@ -256,7 +256,11 @@ def getEpgData(info: EpisodeInfo):
def downloadEpg():
url = f"https://www.onlinetvrecorder.com/epg/csv/epg_{info.datetime.strftime('%Y_%m_%d')}.csv"
logging.debug(f" downloadEpg(): {url}")
request = urllib.request.urlopen(url)
try:
request = urllib.request.urlopen(url)
except requests.exceptions.HTTPError as e:
logging.error(f" failed: {e}")
sys.exit(ExitCode.DownloadingEPGFailed)
if request.getcode() == 200:
data = request.read().decode('latin-1')
with open(filepath, 'w') as f: