Welcome to the Cumulus Support forum.

Latest Cumulus MX release 3.18.0 (build 3190) - 15 June 2022

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are interested in supporting Cumulus then maybe you would like to contribute to the maintenance of the Wiki? This need not take hours of your time - just a half hour here and there can make a big difference, particularly if many people are doing this. Any contributions are very welcome, whether they involve new content or editing of existing content. It will be very helpful to current and future users of Cumulus software if the Wiki is kept well-maintained and current. If you are interested then please contact forum user saratogaWX and ask for a Wiki account.

requests.post from linux to windows

GW1000 WiFi gateway
Post Reply
watsonm
Posts: 85
Joined: Sun 03 Jan 2016 3:39 pm
Weather Station: N96GY -but like Triggers Broom!!
Operating System: Raspberry Pi4 Vers:11 Bullseye
Location: Poundbury, Dorset

requests.post from linux to windows

Post by watsonm »

I appreciate this is more likely to be a network problem but just in case someone has come across it before I'll post it here. I am more a windows man than linux so it could be a configuration problem.

I have a raspbery pi running cumulusmx and a python program on the same device posting my sensor data using the following code

Code: Select all

          try:      
                 x = requests.post( CMX_url , weather_data, timeout = 1.5)
                 y = x.text.find('success')
             
                 if y != 1 :
                    log_err("Ecowitt http output  failed ############# : ")
          except:
                 print("Failed")

where :
CMX_url = "http://localhost:8998/station/ecowitt"
weather_data={'dateutc' : EW_time , 'solarradiation' : LuxW, 'uv' : UV , ..... }

This works fine and if I copy the same code to my Windows box which also has CMX running and run it there it works fine.

Also if I change localhost to the appropriate 192.168.1.x it works fine on both boxes.
Both machines are on my local network with the same network mask.

What fails is if I run the code on the linux box but want to post to the WIndows box.
The command just times out no matter how long I make the timeout.
It doesn't evene execute the find command for "success" but drops straight to the except:

The command works fine from windows to linux!!
There are no obvious errors in the MXdiags file.
I can ping from linux to the windows box.

I have searched the internet but cannot find a solution or discover what I am missing so wonder if anyone has any bright ideas.

Edit: It must be a Linux network issue as http://192.168.1.2:8998 works on the window box but not in the browser of the linux box. However
on another tab in the linux browser I successfully get the CMX dashboard in if use the url http://192.168.1.15:8998
You do not have the required permissions to view the files attached to this post.
Regards Mike

Image
freddie
Posts: 1796
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 20.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: requests.post from linux to windows

Post by freddie »

I'm a bit confused about which host has which IP address. If 192.168.1.15 works in a browser on your Linux box, does that mean your Windows box is using 192.168.1.15?
Freddie
Image
watsonm
Posts: 85
Joined: Sun 03 Jan 2016 3:39 pm
Weather Station: N96GY -but like Triggers Broom!!
Operating System: Raspberry Pi4 Vers:11 Bullseye
Location: Poundbury, Dorset

Re: requests.post from linux to windows

Post by watsonm »

Freddy,
sorry if it was not clear:

192.168.1.15 is a linux box
192.168.1.2 is the windows box

I can ping from linux to WIndows box.
I can get to the cmx desktop on the linux box from the linux box with 192.168.1.15:8998 in a browser
I can get to the cmx desktop on the windows box from the windows box with 192.168.1.2:8998 in a browser
I can get to the cmx desktop on the linux box from the windows box with 192.168.1.15:8998 in a browser
I cannot get to the cmx desktop on the windows box from the linux box with 192.168.1.2:8998

The same success or failure occurs with the request.post call.

I am a linux newbe so do not understand the network tables which I am assuming will hold the answer to my problem.
The browser in the linux box does seem to have difficulties getting to outside websites. Sometimes it works after a long time and sometimes
it times out.
Regards Mike

Image
User avatar
rogerthn
Posts: 387
Joined: Thu 11 Apr 2013 6:31 pm
Weather Station: Ecowitt GW1000/GW1003
Operating System: Raspberry Pi OS Lite Buster
Location: Trollhättan Sweden
Contact:

Re: requests.post from linux to windows

Post by rogerthn »

watsonm wrote: Thu 23 Jun 2022 7:35 am Freddy,
sorry if it was not clear:

192.168.1.15 is a linux box
192.168.1.2 is the windows box

I can ping from linux to WIndows box.
I can get to the cmx desktop on the linux box from the linux box with 192.168.1.15:8998 in a browser
I can get to the cmx desktop on the windows box from the windows box with 192.168.1.2:8998 in a browser
I can get to the cmx desktop on the linux box from the windows box with 192.168.1.15:8998 in a browser
I cannot get to the cmx desktop on the windows box from the linux box with 192.168.1.2:8998

The same success or failure occurs with the request.post call.

I am a linux newbe so do not understand the network tables which I am assuming will hold the answer to my problem.
The browser in the linux box does seem to have difficulties getting to outside websites. Sometimes it works after a long time and sometimes
it times out.
If you have an other Windows box try to get the cmx desktop on the windows box from that, to exclude Windows FW blocking.
Image
watsonm
Posts: 85
Joined: Sun 03 Jan 2016 3:39 pm
Weather Station: N96GY -but like Triggers Broom!!
Operating System: Raspberry Pi4 Vers:11 Bullseye
Location: Poundbury, Dorset

Re: requests.post from linux to windows

Post by watsonm »

Roger,
Thanks for that suggestion and pointer to WIndows FW.

The only other windows box is my wifes laptop which I am not permitted to fiddle with under pain of .....
Instead I tried to access 192.168.1.2:8998 from a browser on her laptop.
This failed so I added a rule in the windows firewall (which I had thought I had turned off as I use Emsisoft software to protect my PC) I had prevously disabled EMSIsoft protection with no improvement but the WIndows firewall rule addition did the trick. I could access the web page and also submit
the requests.post successfully.

Many thanks for your (and Freddys) time in helping with this.... :clap:
Regards Mike

Image
freddie
Posts: 1796
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 20.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: requests.post from linux to windows

Post by freddie »

watsonm wrote: Thu 23 Jun 2022 8:43 am Many thanks for your (and Freddys) time in helping with this.... :clap:
I'm pretty sure I wasn't much help here :lol: but I was thinking Windows firewall rather then Linux networking, hence checking which IP address was which :D
Freddie
Image
User avatar
rogerthn
Posts: 387
Joined: Thu 11 Apr 2013 6:31 pm
Weather Station: Ecowitt GW1000/GW1003
Operating System: Raspberry Pi OS Lite Buster
Location: Trollhättan Sweden
Contact:

Re: requests.post from linux to windows

Post by rogerthn »

watsonm wrote: Thu 23 Jun 2022 8:43 am Instead I tried to access 192.168.1.2:8998 from a browser on her laptop.
That's what I meant :D
watsonm wrote: Thu 23 Jun 2022 8:43 am Many thanks for your (and Freddys) time in helping with this.... :clap:
That's why we are here ;)
Image
Post Reply