Code Monkey home page Code Monkey logo

woice's Introduction

WifiOnICE

A small python script that helps to connect to the WiFiOnICE WiFi that is provided on ICEs these days. It can be used e.g. together with the NetworkManager to automatically connect to the network when entering an ICE train.

Setup

The easiest way to install the woice module is to use pip.

pip3 install -U https://github.com/keans/woice/archive/master.zip

woice's People

Contributors

keans avatar maltere avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

woice's Issues

Feature Request: Make NetworkManager-script distribution-ready.

I have made an Arch Linux package of this.

Feature requests:

  • Include in the build script that in the NetworkManager-script examples/wifionice.sh the now-statically set variable WOICE=/usr/local/bin/woice is set during build to the place where the woice executable is installed (on a properly packaged installation that would be /usr/bin/woice).
    Also, ${WOICE} should then be replaced by "${WOICE}" (i.e. with double quotes), so that "weird" path names do not lead to unexpected, potentially harmful, results. Similar with the $([...])-calls in the script.

  • Make the interface name to be passed to the script by NetworkManager, and not hardcoded.
    According to this manpage for NetworkManager-dispatcher, the interface name should be passed to the script by the first argument. It might be interesting to read the whole manpage, since it explains all the information that is passed to the script.
    (I don't use NetworkManager, so I cannot help in that. I just want to package the software as useful as possible.)
    So, INTERFACE="wlp1s0" could be changed to INTERFACE="$1".
    (In the beginning of the script you already set interface=$1, but you don't seem use this variable anymore.)

  • To still work properly when more than one wireless interface is present/ configured, iwgetid -r should be changed to iwgetid "${INTERFACE}" -r.

  • Provide an installation option to automatically install the network manager script to a location where NetworkManager does find it, e.g. /etc/NetworkManager/dispatcher.d/wifionice.sh.

I have attached the patch to examples/wifionice.sh that I personally use. Note that I have hardcoded WOICE="/usr/bin/woice" there, since I am not familiar with python setuptools: nm-wifionice.sh-distributionready.patch.txt. It has also some other changes (mostly adding ", and removing spourious whitespace).

Regards!

Feature Request: Support also `WIFI@DB` and maybe `DBLounge` ESSID.

Nowadays, the ESSID WIFI@DB is also common for Deutsche Bahn-Wifi. But at some places, only the WIFIonICE is present, on others, only the WIFI@DB is present, on most places, both are present. And then we still have the DB-Lounge-Wifi DBLounge. Sometimes also only one of those networks actually work, even if more are present and connect.

At least the former two, and if I remember correctly also the third, all work via accessing http://wifionice.de/ with the webbrowser and logging in that way.

So I have a feature request:

Wherever you have an ESSID hardcoded (e.g. in the NetworkManager helper script examples/wifionice.sh), support all those ESSIDs.

Regards!

new check box on ICE WiFi

For the login to the ICE WLAN, an "I accept" check box must now be clicked/activated.

This would have to be included in the script.

`woice status` throws exceptions `socket.gaierror: [Errno -2] Name or service not known`, `requests.exceptions.ConnectionError: HTTPSConnectionPool(host='login.wifionice.de', port=443): Max retries exceeded with url: /de/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f64415fa450>: Failed to establish a new connection: [Errno -2] Name or service not known'))` and others.

Ahoj,

I have installed the current git checkout of woice.

I am connected to WIFI@DB.

woice status throws Python exceptions on me. If this is due to wrong ESSID or URLs, woice should error gracefully and not throw exceptions:

woice status:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urllib3/connection.py", line 186, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f64415fa450>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='login.wifionice.de', port=443): Max retries exceeded with url: /de/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f64415fa450>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/woice", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/woice/woice.py", line 114, in main
    moim = WifiOnIceManager()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/woice/woice.py", line 37, in __init__
    self._get_state()
  File "/usr/lib/python3.11/site-packages/woice/woice.py", line 62, in _get_state
    r = self.s.get(LOGIN_URL, headers=HEADERS, allow_redirects=True)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 600, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 565, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='login.wifionice.de', port=443): Max retries exceeded with url: /de/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f64415fa450>: Failed to establish a new connection: [Errno -2] Name or service not known'))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.