<commit_before>Unofficial Brain.fm Python Client (3.5+)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``Connection`` class exposes three operations: ``login``, ``list_stations``, and ``get_token``.
Please open an issue if there's another operation you need.

This client requires Python 3.5+.

============
 Quickstart
============

::

    pip install brainfm

.. code-block:: pycon

    >>> import brainfm
    >>> client = brainfm.Connection()
    >>> client.login("<EMAIL>", "hunter2")
    >>> client.list_stations()
    [{'name': 'Cinematic Music Focus', 'id': 300,
      'string_id': 'explore.focus.cinematic'},
     {'name': 'Beach Focus', 'id': 53,
      'string_id': 'explore.focus.beach'},
     ...]
    >>> token = client.get_token(53)
    >>> token
    '<KEY>'
    >>> brainfm.build_stream_url(token)
    'https://stream.brain.fm/?tkn=63f4b59b-93f4-45e6-b0c2-eb6b1582fb96'

Now, open the stream using that token::

    https://stream.brain.fm/?tkn=63f4b59b-93f4-45e6-b0c2-eb6b1582fb96

=====
 CLI
=====
<commit_msg>Add CLI Quickstart to README<commit_after>Unofficial Brain.fm Python Client (3.5+)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``Connection`` class exposes three operations: ``login``, ``list_stations``, and ``get_token``.
Please open an issue if there's another operation you need.

This client requires Python 3.5+.

================
 CLI Quickstart
================

::

    $ pip install brainfm
    $ brain init
    Email: <EMAIL>
    Password: <hidden>
    Repeat for confirmation: <hidden>

    Add the following to your .profile, .bashrc, or equivalent:

        export BRAINFM_SID="s%3...s0xo"
    $ # <commands to modify and reload profile>
    $ brain play 300

====================
 Library Quickstart
====================

::

    pip install brainfm

.. code-block:: pycon

    >>> import brainfm
    >>> client = brainfm.Connection()
    >>> client.login("<EMAIL>", "hunter2")
    >>> client.list_stations()
    [{'name': 'Cinematic Music Focus', 'id': 300,
      'string_id': 'explore.focus.cinematic'},
     {'name': 'Beach Focus', 'id': 53,
      'string_id': 'explore.focus.beach'},
     ...]
    >>> token = client.get_token(53)
    >>> token
    '<KEY>'
    >>> brainfm.build_stream_url(token)
    'https://stream.brain.fm/?tkn=63f4b59b-93f4-45e6-b0c2-eb6b1582fb96'

Now, open the stream using that token::

    https://stream.brain.fm/?tkn=63f4b59b-93f4-45e6-b0c2-eb6b1582fb96

=====
 CLI
=====

{'fraction_non_alphanumeric': 0.22576687116564417, 'fraction_numerical': 0.04458077709611452, 'mean_word_length': 3.685823754789272, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 53, 'https://': 4, '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': '6011960', 'n_tokens_mistral': 917, 'n_tokens_neox': 830, 'n_words': 186}