rogro82/PiPup

Image Popup from own Server not working

Opened this issue · 0 comments

Hi I have had issues trying to get this to work properly. I have recently setup a fresh install on a raspberry pi and made the following python program which downloads a photo from one of my security cameras and stores it in a file which it stores on my webserver (tried lighttpd and apache2). Then in theory it should supply it to TV via PIPUP. However only the text comes through. Works fine in a web browser. If I use a internet link to a jpg file it works. If I download that same jpg to my local server and try it then it fails

Anyone able to give some pointers. I am guessing it has to do with my server setup but unsure where to start looking

`import requests
import json

pic = 'http://192.168.0.61/web/auto.jpg?-usr=admin&-pwd=mypassword'
picreq = requests.get(pic, allow_redirects=True)
open('/var/www/html/auto.jpg', 'wb').write(picreq.content)

payload = {
"duration": 10,
"position": 2,
"title": "Security - Front Door",
"titleColor": "#50BFF2",
"titleSize": 10,
"message": "Someone is at the door",
"messageColor": "#fbf5f5",
"messageSize": 14,
"backgroundColor": "#0f0e0e",
"media": { "image": {
"uri": "http://192.168.0.11/auto.jpg"}}
}

request = requests.post('http://192.168.0.120:7979/notify',
data=json.dumps(payload),
headers={'content-type': 'application/json'})
`

if the uri line links to an external website such as
"uri": "https://www.mitre10.com.au/media/catalog/product/m/c/mc07350.jpg"}}
Then it works and displays the image. If I go to http://192.168.0.11/auto.jpg in a web browser on my PC then that also works.

Note: 192.168.0.11 is the IP address if the pi that this script runs on. I have tried replacing the IP address with localhost and 127.0.0.1 and neither works