-
Notifications
You must be signed in to change notification settings - Fork 838
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
files_upload_v2 does not work with io.BytesIO file parameters #1292
Comments
Since |
you also seem to need more permissions for upload_v2? Can that be true? I get: whereas that works with upload (v1) |
v3.19.2 (released a few days ago) adds a |
thanks @eddyg but I think that means I don't get the same info as I did with v1, right? And I need that info for my use case. Previously I could do this with only the upload = client.files_upload(**file_dict)
url = upload["file"]["permalink"] now I can't do this? upload = client.files_upload_v2(**file_dict, request_file_info=False)
url = upload["file"]["permalink"] # OR this upload["files"][0]["permalink"] How can I get that same info with v2? Note I was trying to migrate to v2 because of this warning message: ~\anaconda3\envs\py39\lib\site-packages\slack_sdk\web\internal_utils.py:441: UserWarning: client.files_upload() may cause some issues like timeouts for relatively large files. Our latest recommendation is to use client.files_upload_v2(), which is mostly compatible and much stabler, instead. |
Yes, in that case you will need to add the |
ok fair enough, thanks for the link to the explanation. I will use v1 or change the way I solve my use case with v2 or just add the read scope |
The use case is using I don't think this (bot customization) is possible using does that mean my only options are use v1 and deal with performance issues, use v2 with read scope, or use v2 and don't customize the bot? |
Hi @Alex-ley-scrub from what I know there are limitations with the If I understand your use case correctly I would tend to use |
@eddyg / @seratch / @WilliamBergamin request_file_info: bool = True, # since v3.23, this flag is no longer necessary If so, that is awesome 👏 - thank you |
Is this type hint correct? I tried to pass in a
io.BytesIO
object here as thefile
as I thoughtIOBase
covers that as well as a real file handle (e.g. fromopen("filename", "rb")
) - but it failed withTypeError: object of type '_io.BytesIO' has no len()
- len comes from_to_v2_file_upload_item
I believe. So either the type hint is incorrect or the implementation of_to_v2_file_upload_item
needs tweaking? You could probably just do something like this?Originally posted by @Alex-ley-scrub in #1272 (comment)
The text was updated successfully, but these errors were encountered: