Slack bot gets malformed files when downloading
I've built a small slack bot which is notified when files are shared with it and downloads these files. The problem seems to be that it gets malformed files once downloaded! I've tested on JPEG and XLSM files and can't seem to understand the issue. When trying to download the files manually (via browser) I'm able to get the file via the 'url_private' attribute. Am I missing something? Is there a compression I have to deal with?
The code is similar to the following:
import requests
response = requests.get('<url_private>', headers={'Authorization': 'Bearer <token>'})
if response.status_code == 200: use_file(response.content)
The weird thing is I'm able to retrieve the file (the app and bot has all the relevant scopes and permissions), so I was thinking it all should go smooth from there hence I'm stuck..
Any ideas?
It was actually my bad.. I used the resppnse.text rather than
response.content 🤦♂️
On Wed, Apr 18, 2018, 01:51 Roach [email protected] wrote:
I suspect this is probably an encoding issue - I'll investigate 🤔
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/slackapi/python-slackclient/issues/314#issuecomment-382181797, or mute the thread https://github.com/notifications/unsubscribe-auth/AMLlrbT9h5WBBoPoJEWncb-OQ10yvgDCks5tpnIFgaJpZM4TMDZg .