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

Support pathlike objects in upload util #1656

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

allen-pattern
Copy link

Summary

Allow passing Path objects into file upload functions.

Testing

Attempt to pass a Path object to one of the file upload functions that takes a string path. Also pass a string path to ensure there are no regressions.

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

I did get S3 test failures with the latter (without my change), FYI.

Also switch to inbuilt filename encode helper, since it accepts paths
Copy link
Contributor

@WilliamBergamin WilliamBergamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a nice enhancement 💯 thank you!
Any chance you could add unit tests for file passed as str and os.PathLike? if it is not trivial let me know I will take a look

@WilliamBergamin WilliamBergamin added enhancement M-T: A feature request for new functionality semver:patch web-client labels Feb 18, 2025
@WilliamBergamin WilliamBergamin added this to the 3.35.1 milestone Feb 18, 2025
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.33%. Comparing base (d6c206a) to head (6d0dc4a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1656   +/-   ##
=======================================
  Coverage   85.33%   85.33%           
=======================================
  Files         113      113           
  Lines       12802    12802           
=======================================
  Hits        10924    10924           
  Misses       1878     1878           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:signed enhancement M-T: A feature request for new functionality semver:patch web-client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants