<commit_before>Infinario Python SDK
====================

.. image:: https://travis-ci.org/Infinario/python-sdk.svg
    :target: https://travis-ci.org/Infinario/python-sdk
    :alt: Travis CI

The `infinario.Infinario` class provides access to the Infinario Python tracking API,
supporting both synchronous and asynchronous modes.

You can install the SDK using `pip`::

    pip install infinario

In order to track events, instantiate the class at least with your project token
(can be found in Project Management in your Infinario account), for example:

.. code-block:: python

    from infinario import Infinario

    client = Infinario('12345678-90ab-cdef-1234-567890abcdef')                  # PRODUCTION ENVIRONMENT
    # client = Infinario('12345678-90ab-cdef-1234-567890abcdef', silent=False)  # DEVELOPMENT ENVIRONMENT

We recommend to set the `silent` parameter to `False` in a development environment, as it will cause the Infinario API
to throw exceptions if something goes wrong. When left to the default value `True`, all errors will be logged
(also see the `logger` parameter).


To get results of existing analyses stored in your Infinario project, you need to initialize the client
with the Infinario project secret (found in the Overview screen) as the `secret` keyword argument.

.. code-block:: python

    client = Infinario('12345678-90ab-cdef-1234-567890abcdef',
                       secret='fedcba09-8765-4321-fedc-ba0987654321')<commit_msg>Explain tracking to special targets (instances) in README<commit_after>Infinario Python SDK
====================

.. image:: https://travis-ci.org/Infinario/python-sdk.svg
    :target: https://travis-ci.org/Infinario/python-sdk
    :alt: Travis CI

The `infinario.Infinario` class provides access to the Infinario Python tracking API,
supporting both synchronous and asynchronous modes.

You can install the SDK using `pip`::

    pip install infinario

In order to track events, instantiate the class at least with your project token
(can be found in Project Management in your Infinario account), for example:

.. code-block:: python

    from infinario import Infinario

    client = Infinario('12345678-90ab-cdef-1234-567890abcdef')                  # PRODUCTION ENVIRONMENT
    # client = Infinario('12345678-90ab-cdef-1234-567890abcdef', silent=False)  # DEVELOPMENT ENVIRONMENT

We recommend to set the `silent` parameter to `False` in a development environment, as it will cause the Infinario API
to throw exceptions if something goes wrong. When left to the default value `True`, all errors will be logged
(also see the `logger` parameter).


To get results of existing analyses stored in your Infinario project, you need to initialize the client
with the Infinario project secret (found in the Overview screen) as the `secret` keyword argument.

.. code-block:: python

    client = Infinario('12345678-90ab-cdef-1234-567890abcdef',
                       secret='fedcba09-8765-4321-fedc-ba0987654321')

In case you are tracking your data to an instance other than `cloud.infinario.com`, you need to specify the
API where data should be sent. Please consult our support to find out the exact URI.

.. code-block:: python

    client = Infinario('12345678-90ab-cdef-1234-567890abcdef',
                       target='https://api.infinario.com/')
{'fraction_non_alphanumeric': 0.08940397350993377, 'fraction_numerical': 0.054184226369656835, 'mean_word_length': 3.8653001464128844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, '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': '2908840', 'n_tokens_mistral': 1089, 'n_tokens_neox': 931, 'n_words': 363}