Re: Unable to get the gateway IP of wlan interface using python code

2018-11-13 Thread srinivasan
As am a beginner with the python Syntax, I was able to parse the gateway IP as below, Please do let me know if anyone forsee any issues in the below?: def get_gateway_ip(self): """ Get the Gateway IP address of the AP. :return: Gateway IP. """

Re: Unable to get the gateway IP of wlan interface using python code

2018-11-13 Thread srinivasan
Hi Wildman, The below snippet seems to be fine, how can I specify to get the specific wlan0 interface gateway IP in the below code snippet? # #!/usr/bin/env python import socket import struct def get_gateway_ip(): try: with open("/proc/net/route", "r") as f:

Re: Unable to get the gateway IP of wlan interface using python code

2018-11-12 Thread Wildman via Python-list
I tried posting this already but it didn't make it. I am trying again... On Tue, 13 Nov 2018 01:07:06 +0530, srinivasan wrote: > Dear Python Experts, > > *First method:* > > I need to get the IP address basically the gateway IP I am assuming your platform is Linux. If I am incorrect then ign

Re: Unable to get the gateway IP of wlan interface using python code

2018-11-12 Thread Cameron Simpson
On 12Nov2018 21:17, MRAB wrote: On 2018-11-12 19:37, srinivasan wrote: When I use the subprocess I see the below issue: def get_gateway_ip(self): [...] p = subprocess.Popen('ip route show 0.0.0.0/0 dev wlp1s0 | cut -d\ -f3', stdout=subprocess.PIPE) [...] root:~/qa/test_

Re: Unable to get the gateway IP of wlan interface using python code

2018-11-12 Thread MRAB
On 2018-11-12 19:37, srinivasan wrote: Dear Python Experts, [snip] *SECOND METHOD:* When I use the subprocess I see the below issue: def get_gateway_ip(self): """ Get the IP address to the WIFI module from the AP """ #cmd = 'ip route show 0.0.