Skip to content

Commit

Permalink
fixed integration usage of root_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
uberfastman committed Oct 15, 2024
1 parent 1490d95 commit 0d07260
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
services:

app:
image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.1.0
image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.1.1
platform: linux/amd64
ports:
- "5001:5000"
Expand Down
5 changes: 2 additions & 3 deletions integrations/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from datetime import datetime
from pathlib import Path
from time import sleep
from typing import List, Union, Any
from typing import List, Union

from colorama import Fore, Style
from pydrive2.auth import GoogleAuth
Expand All @@ -31,9 +31,8 @@
class GoogleDriveIntegration(BaseIntegration):

def __init__(self):
super().__init__("google_drive")

self.root_dir = Path(__file__).parent.parent
super().__init__("google_drive")

def _authenticate(self) -> None:

Expand Down
21 changes: 18 additions & 3 deletions integrations/groupme.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import json
import sys
from datetime import datetime
from pathlib import Path
from time import sleep
from typing import List, Dict, Optional, Union
from uuid import uuid4
import sys

from colorama import Fore, Style
from requests import get, post

from integrations.base.integration import BaseIntegration
Expand All @@ -17,14 +19,27 @@
class GroupMeIntegration(BaseIntegration):

def __init__(self):
super().__init__("groupme")

self.root_dir = Path(__file__).parent.parent
super().__init__("groupme")

self.base_url = "https://api.groupme.com/v3"
self.file_service_base_url = "https://file.groupme.com/v1"

def _authenticate(self) -> None:

if not settings.integration_settings.groupme_access_token:
settings.integration_settings.groupme_access_token = input(
f"{Fore.GREEN}What is your GroupMe access token? -> {Style.RESET_ALL}"
)
settings.write_settings_to_env_file(self.root_dir / ".env")

if (settings.integration_settings.groupme_bot_or_user == "bot"
and not settings.integration_settings.groupme_bot_id):
settings.integration_settings.groupme_bot_id = input(
f"{Fore.GREEN}What is your GroupMe bot ID? -> {Style.RESET_ALL}"
)
settings.write_settings_to_env_file(self.root_dir / ".env")

self.headers = {
"Content-Type": "application/json",
"User-Agent": "ff-metrics-weekly-report/1.0.0",
Expand Down
11 changes: 9 additions & 2 deletions integrations/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pathlib import Path
from typing import Union

from colorama import Fore, Style
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
from slack_sdk.web.base_client import SlackResponse
Expand All @@ -26,11 +27,17 @@
class SlackIntegration(BaseIntegration):

def __init__(self):
super().__init__("slack")

self.root_dir = Path(__file__).parent.parent
super().__init__("slack")

def _authenticate(self) -> None:

if not settings.integration_settings.slack_auth_token:
settings.integration_settings.slack_auth_token = input(
f"{Fore.GREEN}What is your Slack authentication token? -> {Style.RESET_ALL}"
)
settings.write_settings_to_env_file(self.root_dir / ".env")

self.client = WebClient(token=settings.integration_settings.slack_auth_token)

def api_test(self):
Expand Down

0 comments on commit 0d07260

Please sign in to comment.