So in normal python, I'm able to upload a file just fine to slack. here is the code:
Code: Select all
my_file = {
'file' : ('/tmp/myfile.pdf', open('/tmp/myfile.pdf', 'rb'), 'pdf')
}
payload={
"filename":"myfile.pdf",
"token":token,
"channels":['#random'],
}
r = requests.post("https://slack.com/api/files.upload", params=payload, files=my_file)
But urequests.py doesn't support the "files" parameter. Is there any hope of using the slack files.upload api with micropython on my nodemcu?
https://api.slack.com/methods/files.upload
https://stackoverflow.com/questions/434 ... d-requests
I don't think I could use the "content" header parameter for the files.upload api because I'll run out of ram on the nodemcu trying to put the file contents into a ram variable.