diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2024-01-06 17:02:32 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:54 +0100 |
commit | 6b5f46d2e1550d94a9beee4b74dc5ba2b2ad5c2e (patch) | |
tree | c95aa2cef546d8acc04ae8dc580e06d38d7f8f8b /slack/util.py | |
parent | af2c56f96d8be2f783332f5e4c502e8d15835b32 (diff) | |
download | wee-slack-6b5f46d2e1550d94a9beee4b74dc5ba2b2ad5c2e.tar.gz |
Use the api_cookie value as the `d` cookie if no keys are specified
Usually, only the `d` cookie is needed, so this allows you to only
specify the value of that cookie without the key if you don't need to
set any other cookies.
Diffstat (limited to 'slack/util.py')
-rw-r--r-- | slack/util.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/slack/util.py b/slack/util.py index 14d18dc..cfe0e03 100644 --- a/slack/util.py +++ b/slack/util.py @@ -56,6 +56,8 @@ def url_encode_if_not_encoded(value: str) -> str: def get_cookies(cookie_config: str) -> str: cookie_pairs = [cookie.split("=", 1) for cookie in cookie_config.split(";")] + if len(cookie_pairs) == 1 and len(cookie_pairs[0]) == 1: + cookie_pairs[0].insert(0, "d") for cookie_pair in cookie_pairs: cookie_pair[0] = cookie_pair[0].strip() cookie_pair[1] = url_encode_if_not_encoded(cookie_pair[1].strip()) |