rogro82 / PiPup

Enhanced notifications for Android TV
237 stars 71 forks source link

Local files from Raspberry Pi using #22

Open javalram opened 4 years ago

javalram commented 4 years ago

Hello,

I'm not able to make it working with a picture from my Raspberry Pi via Python (it worked like a charm linking a picture in Internet). I'm using multipart/form-data and it works fine with a Postman application from my laptop, I checked the code and it looks good. I even generated the code snippet from Postman and it is similar. These are the responses:

It looks like the file is not not being detected by the server. This is my code:


import requests

url = "http://192.168.1.139:7979/notify"

payload = {'title' : 'hola'}

files = [
('image', open('/home/javier/TestNotification/lava.png','rb'))
]

response = requests.request("POST", url, data = payload, files = files)

print(response.text.encode('utf8'))

The text are being displayed and the format is set according to the parameters used but I'm not able to make it show the picture (I tried with multiple pictures and formats just in case...). Any idea of what is happening? Has someone tried this successfully using Python requests?

naigy81 commented 4 years ago

Im having the same problem. Works fine with web url but not with local file on pi. Have tried using file path and also apache, ngnix and a couple of other web servers and none have worked.

As yet noone has replied to my issue.

I have even tried down sizing my images thinking it was maybe a timeout issue but again doesnt help.

If you find a solution it would be great if you can post it.

At the moment I am working on trying to integrate my script with notifications for android tv app but would much rather pipup due to open source and ease of use (except when I want a local image)

benasanders commented 3 years ago

I've only been using this application for a few hours, but I would say that you need to give it the file path as a URI.

So the path to your file would look like this instead : file:///home/javier/TestNotification/lava.png