Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle different fields when get_user('bot_id') #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions connectors/slack/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,21 @@ def from_dict(json: dict):
tz=json["tz"],
tz_label=json["tz_label"],
tz_offset=json["tz_offset"],
profile_avatar_hash=json["profile"]["avatar_hash"],
profile_status_text=json["profile"]["status_text"],
profile_status_emoji=json["profile"]["status_emoji"],
profile_real_name=json["profile"]["real_name"],
profile_display_name=json["profile"]["display_name"],
profile_real_name_normalized=json["profile"]["real_name_normalized"],
profile_display_name_normalized=json["profile"]["display_name_normalized"],
profile_email=json["profile"]["email"],
profile_image_original=json["profile"]["image_original"],
profile_image_24=json["profile"]["image_24"],
profile_image_32=json["profile"]["image_32"],
profile_image_48=json["profile"]["image_48"],
profile_image_72=json["profile"]["image_72"],
profile_image_192=json["profile"]["image_192"],
profile_image_512=json["profile"]["image_512"],
profile_avatar_hash=json["profile"].get("avatar_hash", ""),
profile_status_text=json["profile"].get("status_text", ""),
profile_status_emoji=json["profile"].get("status_emoji", ""),
profile_real_name=json["profile"].get("real_name", ""),
profile_display_name=json["profile"].get("display_name", ""),
profile_real_name_normalized=json["profile"].get("real_name_normalized", ""),
profile_display_name_normalized=json["profile"].get("display_name_normalized", ""),
profile_email=json["profile"].get("email", ""),
profile_image_original=json["profile"].get("image_original", ""),
profile_image_24=json["profile"].get("image_24", ""),
profile_image_32=json["profile"].get("image_32", ""),
profile_image_48=json["profile"].get("image_48", ""),
profile_image_72=json["profile"].get("image_72", ""),
profile_image_192=json["profile"].get("image_192", ""),
profile_image_512=json["profile"].get("image_512", ""),
is_admin=json["is_admin"],
is_owner=json["is_owner"],
is_primary_owner=json["is_primary_owner"],
Expand All @@ -256,7 +256,7 @@ def from_dict(json: dict):
def get_user(user_id: str) -> SlackUser:
token = os.getenv("SLACK_BOT_TOKEN")
if token is None:
raise Exception("SLACK_BOt_TOKEN env var is not set")
raise Exception("SLACK_BOT_TOKEN env var is not set")

response = requests.get(
"https://slack.com/api/users.info",
Expand Down Expand Up @@ -289,7 +289,7 @@ def from_dict(json: dict):
def get_me():
token = os.getenv("SLACK_BOT_TOKEN")
if token is None:
raise Exception("SLACK_BOt_TOKEN env var is not set")
raise Exception("SLACK_BOT_TOKEN env var is not set")

response = requests.get(
"https://slack.com/api/auth.test",
Expand Down