<commit_before>
===============
fritzconnection
===============


.. image::
    https://img.shields.io/pypi/pyversions/fritzconnection.svg
    :alt: Python versions
    :target: https://pypi.org/project/fritzconnection/

.. image::
    https://img.shields.io/pypi/l/fritzconnection.svg
    :target: https://pypi.org/project/fritzconnection/


Python-Tool to communicate with the AVM FritzBox.
Uses the TR-064 protocol.

Installation:
-------------

    pip install fritzconnection


Available Modules, Commands and Tools
-------------------------------------

``fritzconnection.py`` makes the SOAP interface of the FRITZ!Box available on the command line.
Shows all available services and actions when run with the argument ``-c``. Use ``-h`` for help.

This is the main module and works standalone. The other modules listet here are utility modules for convenience and examples on how to use fritzconnection.

``fritzstatus.py`` is a command line interface to display status information of the FRITZ!Box.
It also serves as an example on how to use the fritzconnection module.

``fritzmonitor.py`` is a Tkinter GUI to display current IP as well as the upstream and downstream rates.
It also makes it easy to reconnect and thus get a different IP from your ISP.

``fritzhosts.py`` is a command line interface to display the hosts known by the FRITZ!Box with IP, name, MAC and status.

``fritzwlan.py`` Utility module for FritzConnection to list the known WLAN connections.

``fritzcallforwarding.py`` Utility module for FritzConnection to manage callforwardings.

``fritzphonebook.py`` Utility module for FritzConnection to access phone books.

``fritzcall.py`` Gives access to recent phone calls: incoming, outgoing and missed ones.


Other Files
-----------

``fritztools.py`` contains some helper functions and ``test.py`` contains unit tests.

Quickstart:
-----------

Inspect the API:

    >>> import fritzconnection as fc
    >>> fc.print_api(address=<ip-address>, password=<the password>)

Both parameters ``address`` and ``password`` are optional. If there is more than one Fritz!Box in the network, an address must be provided, because otherwise it's undefined which box will respond. Also most services are only accessible by providing a password.

An API-Call is made by the ``call_action``-method of the FritzConnection-Class. This method takes the ``servicename``, the ``actionname`` and optional arguments as parameter and may return a dictionary with the results (as described in the TR-064 protocoll description). A simple example is to reconnect for a new external ip:

    >>> from fritzconnection import FritzConnection
    >>> connection = FritzConnection()
    >>> connection.call_action('WANIPConn', 'ForceTermination')
    # or more comfortable:
    >>> connection.reconnect()

The latter wrapps the ``call_action``-method. For a more complete example look at the ``fritzhosts.py`` souce-code.


Documentation
-------------

The full documentation and release notes are at https://fritzconnection.readthedocs.org<commit_msg>README updated.<commit_after>
===============
fritzconnection
===============


.. image::
    https://img.shields.io/pypi/pyversions/fritzconnection.svg
    :alt: Python versions
    :target: https://pypi.org/project/fritzconnection/

.. image::
    https://img.shields.io/pypi/l/fritzconnection.svg
    :target: https://pypi.org/project/fritzconnection/


Python-Tool to communicate with the AVM FritzBox.
Uses the TR-064 protocol over Upnp.

Installation:
-------------

    pip install fritzconnection


Quickstart:
-----------

Pip will install a command line tool to inspect the FRITZ!Box-API. The APIs can differ depending on the FRITZ!Box model and the system software.

    $ fritzconnection -i <the_ip_address> -p <the_password> -s

This will list all available services. Both parameters ``the_ip_address`` and ``the_password`` are optional. If there is more than one Fritz!Box in the network, an address must be provided, because otherwise it's undefined which box will respond. Also most services are only accessible by providing a password. To list the ``actions`` of a ``service`` use the option ``-S`` with the 'servicename' as parameter, i.e.:

    $ fritzconnection <the_ip_address> -p <the_password> -S WLANConfiguration1

With the option ``-a`` and a 'servicename' given all parameters for the available ``actions`` are listet:

    $ fritzconnection <the_ip_address> -p <the_password> -a WLANConfiguration1

The option ``-A`` with 'servicename' and 'actionname' as parameter will also list ``direction`` and the ``data type`` of the action parameters:

    $ fritzconnection <the_ip_address> -p <the_password> -A WLANConfiguration1 GetGenericAssociatedDeviceInfo


An API-Call is made by the ``call_action``-method of the FritzConnection-Class. This method takes the ``servicename``, the ``actionname`` and optional arguments as parameter and may return a dictionary with the results (as described in the TR-064 protocoll description). A simple example is to reconnect for a new external ip:

    >>> from fritzconnection import FritzConnection
    >>> connection = FritzConnection()
    >>> connection.call_action('WANIPConn', 'ForceTermination')
    # or more comfortable:
    >>> connection.reconnect()

The latter wrapps the ``call_action``-method. For more complete examples look at the source-code of the modules in the ``fritzconnection/lib`` folder.


Documentation
-------------

The full documentation and release notes are at https://fritzconnection.readthedocs.org
{'fraction_non_alphanumeric': 0.11618257261410789, 'fraction_numerical': 0.0027061158217571712, 'mean_word_length': 4.008130081300813, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 43, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6359255', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1454, 'n_words': 624}