Exemple #1
0
 def __init__(self):
     self.strava_resource = StravaResource()
     self.app_constants = AppConstants()
     self.app_variables = AppVariables()
     self.operations = Operations()
     self.database_resource = DatabaseResource()
     self.telegram_resource = TelegramResource()
     self.iron_cache_resource = IronCacheResource()
     self.athlete_resource = AthleteResource()
 def __init__(self):
     self.bot_constants = AppConstants()
     self.bot_variables = AppVariables()
     self.operations = Operations()
     self.aes_cipher = AESCipher(self.bot_variables.crypt_key_length,
                                 self.bot_variables.crypt_key)
     self.telegram_resource = TelegramResource()
     self.database_resource = DatabaseResource()
     self.strava_resource = StravaResource()
     self.athlete_resource = AthleteResource()
     self.iron_cache_resource = IronCacheResource()
     self.auto_update_indoor_ride = AutoUpdateIndoorRide()
     self.activity_summary = ActivitySummary()
Exemple #3
0
 def __init__(self):
     self.app_variables = AppVariables()
     self.app_constants = AppConstants()
     self.strava_client = StravaClient()
     self.strava_configs = {
         "bot": {
             "client_id": self.app_variables.client_id,
             "client_secret": self.app_variables.client_secret
         },
         "challenges": {
             "client_id": self.app_variables.challenges_client_id,
             "client_secret": self.app_variables.challenges_client_secret
         }
     }
import logging

from flask import Flask, request, jsonify
from scout_apm.flask import ScoutApm

from app.commands.challenges import CalculateChallengesStats, Challenges
from app.common.constants_and_variables import AppVariables, AppConstants
from app.common.execution_time import execution_time
from app.processor import update_stats, handle_webhook, telegram_send_message, challenges_api_hits, \
    telegram_send_approval_message
from app.resources.athlete import AthleteResource
from app.resources.database import DatabaseResource
from app.resources.iron_cache import IronCacheResource
from app.resources.strava import StravaResource

app_variables = AppVariables()
app_constants = AppConstants()
strava_resource = StravaResource()
athlete_resource = AthleteResource()
database_resource = DatabaseResource()
iron_cache_resource = IronCacheResource()
calculate_challenge_stats = CalculateChallengesStats()
challenges = Challenges()

app = Flask(__name__)
app.config.from_object(__name__)

ScoutApm(app)

app.config['SCOUT_MONITOR'] = app_variables.scout_monitor
app.config['SCOUT_KEY'] = app_variables.scout_key
Exemple #5
0
 def __init__(self):
     self.app_variables = AppVariables()
     self.app_constants = AppConstants()
     self.host = self.app_variables.api_host
 def __init__(self):
     self.app_constants = AppConstants()
     self.app_variables = AppVariables()
     self.strava_telegram_webhooks = StravaTelegramWebhooksResource()
     self.aes_cipher = AESCipher(self.app_variables.crypt_key_length,
                                 self.app_variables.crypt_key)
     self.challenges_config = {
         'cadence90': {
             'odd': {
                 'challenge_ids': self.cadence90_odd_challenge_ids,
                 'query_insert':
                 self.app_constants.QUERY_CHALLENGES_ODD_INSERT_VALUES,
                 'query_update':
                 self.app_constants.QUERY_CHALLENGES_ODD_UPDATE_VALUES,
                 'payment_approval': False,
                 'payment_approval_details': self.cadence90_odd_payment
             },
             'even': {
                 'challenge_ids': self.cadence90_even_challenge_ids,
                 'query_insert':
                 self.app_constants.QUERY_CHALLENGES_EVEN_INSERT_VALUES,
                 'query_update':
                 self.app_constants.QUERY_CHALLENGES_EVEN_UPDATE_VALUES,
                 'payment_approval': False,
                 'payment_approval_details': self.cadence90_even_payment
             }
         },
         'bosch': {
             'odd': {
                 'challenge_ids': self.bosch_odd_challenge_ids,
                 'query_insert': self.app_constants.
                 QUERY_CHALLENGES_BOSCH_ODD_INSERT_VALUES,
                 'query_update': self.app_constants.
                 QUERY_CHALLENGES_BOSCH_ODD_UPDATE_VALUES,
                 'payment_approval': False,
                 'payment_approval_details': self.bosch_odd_payment
             },
             'even': {
                 'challenge_ids': self.bosch_even_challenge_ids,
                 'query_insert': self.app_constants.
                 QUERY_CHALLENGES_BOSCH_EVEN_INSERT_VALUES,
                 'query_update': self.app_constants.
                 QUERY_CHALLENGES_BOSCH_EVEN_UPDATE_VALUES,
                 'payment_approval': False,
                 'payment_approval_details': self.bosch_even_payment
             }
         },
         'tok': {
             'odd': {
                 'challenge_ids': self.tok_odd_challenge_ids,
                 'query_insert':
                 self.app_constants.QUERY_CHALLENGES_TOK_ODD_INSERT_VALUES,
                 'query_update':
                 self.app_constants.QUERY_CHALLENGES_TOK_ODD_UPDATE_VALUES,
                 'payment_approval': False,
                 'payment_approval_details': self.tok_odd_payment
             },
             'even': {
                 'challenge_ids': self.tok_even_challenge_ids,
                 'query_insert':
                 self.app_constants.QUERY_CHALLENGES_TOK_EVEN_INSERT_VALUES,
                 'query_update':
                 self.app_constants.QUERY_CHALLENGES_TOK_EVEN_UPDATE_VALUES,
                 'payment_approval': False,
                 'payment_approval_details': self.tok_even_payment
             }
         }
     }
Exemple #7
0
 def __init__(self):
     self.app_variables = AppVariables()
     self.app_constants = AppConstants()
     self.database_client = DatabaseClient()
Exemple #8
0
 def __init__(self):
     self.bot_constants = AppConstants()
     self.bot_variables = AppVariables()
 def __init__(self):
     self.telegram_client = TelegramClient()
     self.api_send_message = self.telegram_client.api_send_message()
     self.app_variables = AppVariables()
 def __init__(self):
     self.bot_variables = AppVariables()
Exemple #11
0
 def __init__(self):
     self.app_constants = AppConstants()
     self.app_variables = AppVariables()
     self.strava_telegram_webhooks = StravaTelegramWebhooksResource()
     self.aes_cipher = AESCipher(self.app_variables.crypt_key_length,
                                 self.app_variables.crypt_key)
Exemple #12
0
 def __init__(self):
     self.app_variables = AppVariables()