Skip to content

Commit

Permalink
remove apprise
Browse files Browse the repository at this point in the history
  • Loading branch information
saltydk committed Apr 23, 2024
1 parent 17e3f0a commit 6004b6d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
14 changes: 0 additions & 14 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
import logging
import requests
import redis
import apprise
import json
from flask import Flask, request, jsonify, make_response
from datetime import datetime

# Development Configurations
DEV_CONFIG = {
'GITHUB_PATS': 'YOUR_DEV_PAT1,YOUR_DEV_PAT2',
'APPRISE_URL': 'YOUR_DEV_APPRISE_URL',
'API_USAGE_THRESHOLD': 50,
'REDIS_HOST': 'localhost'
}
Expand Down Expand Up @@ -44,15 +42,13 @@ def format(self, record):
# Set configurations
if is_development:
ACCESS_TOKENS = DEV_CONFIG['GITHUB_PATS'].split(',')
APPRISE_URL = DEV_CONFIG['APPRISE_URL']
API_USAGE_THRESHOLD = DEV_CONFIG['API_USAGE_THRESHOLD']
REDIS_HOST = DEV_CONFIG['REDIS_HOST']
else:
for var in ['GITHUB_PATS', 'APPRISE_URL', 'API_USAGE_THRESHOLD', 'REDIS_HOST']:
if not os.environ.get(var):
raise EnvironmentError(f"{var} not set in environment variables!")
ACCESS_TOKENS = os.environ['GITHUB_PATS'].split(',')
APPRISE_URL = os.environ['APPRISE_URL']
API_USAGE_THRESHOLD = int(os.environ['API_USAGE_THRESHOLD'])
REDIS_HOST = os.environ['REDIS_HOST']

Expand All @@ -78,9 +74,6 @@ def format(self, record):
app = Flask(__name__)
current_token_idx = 0

ap = apprise.Apprise()
ap.add(APPRISE_URL)

redis_client = redis.StrictRedis(host=REDIS_HOST, port=6379, db=0, decode_responses=True)


Expand All @@ -93,13 +86,6 @@ def set_to_cache(key, data, etag):
redis_client.expire(key, 86400) # cache for 24 hours


def send_notification(title, message):
ap.notify(
body=message,
title=title,
)


@app.route('/version', methods=["GET"])
def proxy():
global current_token_idx
Expand Down
1 change: 0 additions & 1 deletion app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
requests~=2.31.0
redis~=5.0.1
apprise~=1.5.0
flask~=3.0.0
gunicorn~=21.2.0

0 comments on commit 6004b6d

Please sign in to comment.