I'm trying to use the Requests library make a POST call to Slack using Python 3.4 on a Mac (OS X 10.10), like so:
url = 'https://slack.com/api/files.upload'
with open('File β.txt', 'rb') as file:
r = requests.post(url, files={'file': file}, params={
'token': api_token,
'channels': channel
})
But then I get a "no_file_data" response from Slack. If I use an ASCII "B" character instead of the unicode beta, then it works fine.
My file is UTF-8 encoded, and I have this line below my hashbang:
# -*- coding: UTF-8 -*-
Is this a problem with Slack, or something I'm doing wrong in Python?