aboutsummaryrefslogtreecommitdiffstats
path: root/slack/api.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2022-10-29 16:57:53 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:52 +0100
commitacaf2e81719ba160aac3bc7c3c78fc4db3d13f65 (patch)
treea23c4c04ac63987312ce2ff9bb6fc1351c887dfe /slack/api.py
parentcdf3cfe4a2ed8a340ac1a8404e7cd7e604fe3857 (diff)
downloadwee-slack-acaf2e81719ba160aac3bc7c3c78fc4db3d13f65.tar.gz
Use class for shared, so we don't have to change usage when combining
Diffstat (limited to 'slack/api.py')
-rw-r--r--slack/api.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/slack/api.py b/slack/api.py
index 8b7a377..4cdc53d 100644
--- a/slack/api.py
+++ b/slack/api.py
@@ -1,19 +1,15 @@
from __future__ import annotations
import json
-from typing import TYPE_CHECKING, Any, Dict, Union
+from typing import TYPE_CHECKING, Dict, Union
from urllib.parse import urlencode
-from . import globals as G
+from slack.shared import shared
+
from .http import http_request
if TYPE_CHECKING:
from slack_api import SlackConversation, SlackConversationIm, SlackConversationNotIm
-else:
- # To support running without slack types
- SlackConversation = Any
- SlackConversationNotIm = Any
- SlackConversationIm = Any
class SlackApi:
@@ -22,7 +18,7 @@ class SlackApi:
def get_request_options(self):
return {
- "useragent": f"wee_slack {G.SCRIPT_VERSION}",
+ "useragent": f"wee_slack {shared.SCRIPT_VERSION}",
"httpheader": f"Authorization: Bearer {self.workspace.config.api_token.value}",
"cookie": self.workspace.config.api_cookies.value,
}
@@ -56,7 +52,7 @@ class SlackApi:
class SlackWorkspace:
def __init__(self, name: str):
self.name = name
- self.config = G.config.create_workspace_config(self.name)
+ self.config = shared.config.create_workspace_config(self.name)
self.api = SlackApi(self)