slackapi / python-slack-sdk

Slack Developer Kit for Python
https://tools.slack.dev/python-slack-sdk/
MIT License
3.85k stars 837 forks source link

Using the new channel parameter with a single str #1315

Closed GreekGreenGeek closed 1 year ago

GreekGreenGeek commented 1 year ago

I write a script to upload a file and in my call I get the message. But I can't find anything in the doc related to this message. In the examples there is not even client.files_upload_v2() which is recommended.

/Users/spyros.m/Developer/Scripts/Python/audit_macos/venv/lib/python3.11/site-packages/slack_sdk/web/client.py:3032: UserWarning: Although the channels parameter is still supported for smooth migration from legacy files.upload, we recommend using the new channel parameter with a single str value instead for more clarity.

How to solve this warning?

seratch commented 1 year ago

Hi @GreekGreenGeek, you can migrate to v2 method as below:

result = client.files_upload_v2( # files_upload -> files_upload_v2
    channel=channel_id, # channels -> channel
    initial_comment="Here's my file :smile:",
    file=file_name,
)

Also, please refer to the release notes https://github.com/slackapi/python-slack-sdk/releases/tag/v3.19.0 for more details.

I hope this was helpful to you!

github-actions[bot] commented 1 year ago

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.

seratch commented 1 year ago

Thanks for your reaction 👍 Let me close this issue now.