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

Fix base url according to official documentation #1485

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion slack/web/async_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


class AsyncBaseClient:
BASE_URL = "https://www.slack.com/api/"
BASE_URL = "https://slack.com/api/"

def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion slack/web/async_internal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _get_url(base_url: str, api_method: str) -> str:

Returns:
The absolute API URL.
e.g. 'https://www.slack.com/api/chat.postMessage'
e.g. 'https://slack.com/api/chat.postMessage'
"""
return urljoin(base_url, api_method)

Expand Down
2 changes: 1 addition & 1 deletion slack/web/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@


class BaseClient:
BASE_URL = "https://www.slack.com/api/"
BASE_URL = "https://slack.com/api/"

def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion slack_sdk/rtm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RTMClient(object): # skipcq: PYL-R0205
Default is 30.
base_url (str): The base url for all HTTP requests.
Note: This is only used in the WebClient.
Default is "https://www.slack.com/api/".
Default is "https://slack.com/api/".
connect_method (str): An string specifying if the client
will connect with `rtm.connect` or `rtm.start`.
Default is `rtm.connect`.
Expand Down
4 changes: 2 additions & 2 deletions slack_sdk/web/async_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


class AsyncBaseClient:
BASE_URL = "https://www.slack.com/api/"
BASE_URL = "https://slack.com/api/"

def __init__(
self,
Expand All @@ -47,7 +47,7 @@ def __init__(
"""A string specifying an `xoxp-*` or `xoxb-*` token."""
self.base_url = base_url
"""A string representing the Slack API base URL.
Default is `'https://www.slack.com/api/'`."""
Default is `'https://slack.com/api/'`."""
self.timeout = timeout
"""The maximum number of seconds the client will wait
to connect and receive a response from Slack.
Expand Down
2 changes: 1 addition & 1 deletion slack_sdk/web/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class AsyncWebClient(AsyncBaseClient):
Attributes:
token (str): A string specifying an `xoxp-*` or `xoxb-*` token.
base_url (str): A string representing the Slack API base URL.
Default is `'https://www.slack.com/api/'`
Default is `'https://slack.com/api/'`
timeout (int): The maximum number of seconds the client will wait
to connect and receive a response from Slack.
Default is 30 seconds.
Expand Down
8 changes: 4 additions & 4 deletions slack_sdk/web/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


class BaseClient:
BASE_URL = "https://www.slack.com/api/"
BASE_URL = "https://slack.com/api/"

def __init__(
self,
Expand All @@ -59,7 +59,7 @@ def __init__(
"""A string specifying an `xoxp-*` or `xoxb-*` token."""
self.base_url = base_url
"""A string representing the Slack API base URL.
Default is `'https://www.slack.com/api/'`."""
Default is `'https://slack.com/api/'`."""
self.timeout = timeout
"""The maximum number of seconds the client will wait
to connect and receive a response from Slack.
Expand Down Expand Up @@ -223,7 +223,7 @@ def _urllib_api_call(

Args:
token: Slack API Token (either bot token or user token)
url: Complete URL (e.g., https://www.slack.com/api/chat.postMessage)
url: Complete URL (e.g., https://slack.com/api/chat.postMessage)
query_params: Query string
json_body: JSON data structure (it's still a dict at this point),
if you give this argument, body_params and files will be skipped
Expand Down Expand Up @@ -324,7 +324,7 @@ def _perform_urllib_http_request(self, *, url: str, args: Dict[str, Dict[str, An
"""Performs an HTTP request and parses the response.

Args:
url: Complete URL (e.g., https://www.slack.com/api/chat.postMessage)
url: Complete URL (e.g., https://slack.com/api/chat.postMessage)
args: args has "headers", "data", "params", and "json"
"headers": Dict[str, str]
"data": Dict[str, Any]
Expand Down
2 changes: 1 addition & 1 deletion slack_sdk/web/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class WebClient(BaseClient):
Attributes:
token (str): A string specifying an `xoxp-*` or `xoxb-*` token.
base_url (str): A string representing the Slack API base URL.
Default is `'https://www.slack.com/api/'`
Default is `'https://slack.com/api/'`
timeout (int): The maximum number of seconds the client will wait
to connect and receive a response from Slack.
Default is 30 seconds.
Expand Down
2 changes: 1 addition & 1 deletion slack_sdk/web/internal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _get_url(base_url: str, api_method: str) -> str:

Returns:
The absolute API URL.
e.g. 'https://www.slack.com/api/chat.postMessage'
e.g. 'https://slack.com/api/chat.postMessage'
"""
return urljoin(base_url, api_method)

Expand Down
8 changes: 4 additions & 4 deletions slack_sdk/web/legacy_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


class LegacyBaseClient:
BASE_URL = "https://www.slack.com/api/"
BASE_URL = "https://slack.com/api/"

def __init__(
self,
Expand All @@ -62,7 +62,7 @@ def __init__(
"""A string specifying an `xoxp-*` or `xoxb-*` token."""
self.base_url = base_url
"""A string representing the Slack API base URL.
Default is `'https://www.slack.com/api/'`."""
Default is `'https://slack.com/api/'`."""
self.timeout = timeout
"""The maximum number of seconds the client will wait
to connect and receive a response from Slack.
Expand Down Expand Up @@ -298,7 +298,7 @@ def _urllib_api_call(

Args:
token: Slack API Token (either bot token or user token)
url: Complete URL (e.g., https://www.slack.com/api/chat.postMessage)
url: Complete URL (e.g., https://slack.com/api/chat.postMessage)
query_params: Query string
json_body: JSON data structure (it's still a dict at this point),
if you give this argument, body_params and files will be skipped
Expand Down Expand Up @@ -398,7 +398,7 @@ def _perform_urllib_http_request(self, *, url: str, args: Dict[str, Dict[str, An
"""Performs an HTTP request and parses the response.

Args:
url: Complete URL (e.g., https://www.slack.com/api/chat.postMessage)
url: Complete URL (e.g., https://slack.com/api/chat.postMessage)
args: args has "headers", "data", "params", and "json"
"headers": Dict[str, str]
"data": Dict[str, Any]
Expand Down
2 changes: 1 addition & 1 deletion slack_sdk/web/legacy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LegacyWebClient(LegacyBaseClient):
Attributes:
token (str): A string specifying an `xoxp-*` or `xoxb-*` token.
base_url (str): A string representing the Slack API base URL.
Default is `'https://www.slack.com/api/'`
Default is `'https://slack.com/api/'`
timeout (int): The maximum number of seconds the client will wait
to connect and receive a response from Slack.
Default is 30 seconds.
Expand Down
2 changes: 1 addition & 1 deletion tests/rtm/test_rtm_client_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_start_raises_an_error_if_rtm_ws_url_is_not_returned(self):
RTMClient(token="xoxp-1234", auto_reconnect_enabled=False).start()

expected_error = (
"The request to the Slack API failed. (url: https://www.slack.com/api/auth.test)\n"
"The request to the Slack API failed. (url: https://slack.com/api/auth.test)\n"
"The server responded with: {'ok': False, 'error': 'invalid_auth'}"
)
self.assertIn(expected_error, str(context.exception))
2 changes: 1 addition & 1 deletion tests/slack_sdk/rtm_v2/test_rtm_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_start_raises_an_error_if_rtm_ws_url_is_not_returned(self):
RTMClient(token="xoxp-1234", auto_reconnect_enabled=False).start()

expected_error = (
"The request to the Slack API failed. (url: https://www.slack.com/api/auth.test)\n"
"The request to the Slack API failed. (url: https://slack.com/api/auth.test)\n"
"The server responded with: {'ok': False, 'error': 'invalid_auth'}"
)
self.assertIn(expected_error, str(context.exception))