From 2e3bbda133469311d730a1047f8053ae7196eb20 Mon Sep 17 00:00:00 2001 From: Larsen Vallecillo Date: Sun, 4 Oct 2020 13:36:06 -0500 Subject: [PATCH] Add Sentry (#5) * Add Sentry logging * Fix encoding * Fix encoding again * Fix encoding again --- requirements.txt | 1 + riitag/user.py | 6 +++--- start.py | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 19ea512..5ec10c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ requests prompt_toolkit pypresence nest_asyncio +sentry_sdk diff --git a/riitag/user.py b/riitag/user.py index 599cb68..c2ddb54 100644 --- a/riitag/user.py +++ b/riitag/user.py @@ -57,8 +57,8 @@ def __str__(self): def download_titles(self): if not path.exists("cache/titles.txt"): - f = open("cache/titles.txt", "w") - f.write(requests.get(TITLES_URL, headers=HEADERS).text) + f = open("cache/titles.txt", "w", encoding='utf8') + f.write(requests.get(TITLES_URL, headers=HEADERS).text.encode('utf8').decode('ascii', 'ignore')) f.close() def load_titles(self): @@ -105,4 +105,4 @@ def fetch_riitag(self): riitag = RiitagInfo(**data) self.riitag = riitag - return riitag \ No newline at end of file + return riitag diff --git a/start.py b/start.py index fd7d4b5..4e00255 100644 --- a/start.py +++ b/start.py @@ -1,5 +1,6 @@ import json import os +import sentry_sdk import sys import nest_asyncio @@ -15,6 +16,11 @@ import menus from riitag import oauth2, user, watcher, presence, preferences +sentry_sdk.init( + "https://0206915cd7604929997a753583292296@o107347.ingest.sentry.io/5450405", + traces_sample_rate=1.0 +) + nest_asyncio.apply() # Get resource when frozen with PyInstaller