Skip to content

Commit f5b39e0

Browse files
authored
migrate to files_upload_v2 in the readme (#1402)
1 parent 91c22ea commit f5b39e0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Here we also ensure that the response back from Slack is a successful one and th
113113

114114
#### Uploading files to Slack
115115

116-
We've changed the process for uploading files to Slack to be much easier and straight forward. You can now just include a path to the file directly in the API call and upload it that way. You can find the details on this api call [here][files.upload]
116+
We've changed the process for uploading files to Slack to be much easier and straight forward. You can now just include a path to the file directly in the API call and upload it that way.
117117

118118
```python
119119
import os
@@ -124,7 +124,7 @@ client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])
124124

125125
try:
126126
filepath="./tmp.txt"
127-
response = client.files_upload(channels='#random', file=filepath)
127+
response = client.files_upload_v2(channel='C0123456789', file=filepath)
128128
assert response["file"] # the uploaded file
129129
except SlackApiError as e:
130130
# You will get a SlackApiError if "ok" is False
@@ -133,6 +133,8 @@ except SlackApiError as e:
133133
print(f"Got an error: {e.response['error']}")
134134
```
135135

136+
More details on the `files_upload_v2` method can be found [here][files_upload_v2].
137+
136138
### Async usage
137139

138140
`AsyncWebClient` in this SDK requires [AIOHttp][aiohttp] under the hood for asynchronous requests.
@@ -292,6 +294,6 @@ helpful and collaborative way.
292294
[pypi]: https://pypi.org/
293295
[gh-issues]: https://github.com/slackapi/python-slack-sdk/issues
294296
[slack-community]: https://slackcommunity.com/
295-
[files.upload]: https://api.slack.com/methods/files.upload
297+
[files_upload_v2]: https://github.com/slackapi/python-slack-sdk/releases/tag/v3.19.0
296298
[aiohttp]: https://aiohttp.readthedocs.io/
297299
[urllib]: https://docs.python.org/3/library/urllib.request.html

0 commit comments

Comments
 (0)