Python Forum
Check network WITHOUT use internet
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check network WITHOUT use internet
#1
I know one of code is works great as:
try:
    import httplib
except:
    import http.client as httplib

def checkInternetHttplib(url="www.google.com", timeout=3):
    conn = httplib.HTTPConnection(url, timeout=timeout)
    try:
        conn.request("HEAD", "/")
        conn.close()
        return True
    except Exception as e:
        print(e)
        return False
That is use the internet...
But I would like to use local like 192.168.1.1 WITHOUT the internet, how can I code this? url="192.168.1.1" ?
Reply
#2
try replacing "www.google.com" with local ip address
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  error opening port from local to internet looney99 3 2,774 Oct-16-2020, 02:01 PM
Last Post: BeanieW
  Network check... ATARI_LIVE 2 3,980 Sep-23-2020, 02:55 PM
Last Post: ATARI_LIVE
  Is it possible to trun local internet access off programmatically? Larz60+ 4 3,429 Sep-25-2018, 08:10 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020