title: Python check For network connection
body: <p>I want to know is there any python script (better a command) that can tell me am I connected to network or not.</p>
  <p>I am not talking about &quot;INTERNET&quot;, i'm talking about wired or wireless &quot;NETWORK&quot;
  (So please do not set this quetion as duplicate)</p>
  <p>I mean my modem router is on and i'm connected to it (and it's not important it has internet or not) so the script returns True
  (It's better to not suggest terminal commands like ping  etc.)</p>
  <p>And also another question that might be an answer of this question:
  Is it good to get <code>requests.get('192.168.1.1').status_code</code> and if its 200 we're connected to a network?</p>