<commit_before>============
Installation
============

Install Tarbell with `pip install tarbell`
------------------------------------------

.. code-block:: bash

    pip install -e git+https://github.com/newsapps/flask-tarbell@0.9-beta7#egg=tarbell

.. note::

  Tarbell requires Python 2.7 and Git (v1.5.2+). Tarbell does not currently support Python 3.

  Tarbell does not work on Windows machines.

Configure Tarbell with `tarbell configure`
------------------------------------------

The ``tarbell configure`` command will set up your Tarbell settings

.. code-block:: bash

  tarbell configure

Please consider setting up Google spreadsheet access for collaborative data editing and Amazon
S3 settings for easy publishing.


Configure Google spreadsheet access (optional)
----------------------------------------------

In order to allow Tarbell to create new Google Spreadsheets, you'll need to
download a `client_secrets.json file <https://developers.google.com/api-client-library/python/guide/aaa_client_secrets>`_
to access the Google Drive API. You can share this file with collaborators and
within your organization, but do not share this file anywhere public.

Log in to the `Google API Developer Console <https://cloud.google.com/console/project>`_ and create a new project:

.. image:: create_1_new.png

.. image:: create_1-5_new.png
   :width: 700px


Now click the "APIs & auth" tab. (Click on the "APIs" tab below that if it 
doesn't open automatically.) Enable Google Drive API.

.. image:: create_2_new.png
   :width: 700px


Click the "Credentials" tab (right below "APIs") to create a client ID:

.. image:: create_3_new.png
   :width: 700px


Select "installed app":

.. image:: create_5_new.png
   :width: 700px


Whew! Now you can download the ``client_secrets.json`` file:

.. image:: create_6_new.png
   :width: 700px


The file you download will be called something like 
``client_secret_longstringofrandomlettersandnumbers.apps.googleusercontent.json``.

Rename it to `client_secrets.json`.

Now, you do one of the following:

* Copy ``client_secrets.json`` to ``~/.tarbell/client_secrets.json``.
* Specify the ``client_secrets.json`` download location when running ``tarbell configure``. (By default, Tarbell will attempt to find this file in your ``Downloads`` directory.)

The first time a Tarbell command needs access to a Google spreadsheet (say, while you're running `tarbell configure`), you'll be prompted to
authenticate

.. code-block:: bash

  Go to the following link in your browser:

      https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=705475625983-bdm46bacl3v8hlt4dd9ufvgsmgg3jrug.apps.googleusercontent.com&access_type=offline

  Enter verification code: 

Follow the link:

.. image:: create_7_new.png

You should receive a confirmation code:

.. image:: create_8.png


Enter it. If it works, you'll see:

  Authentication successful.

Now you can access and create Google spreadsheets to use with Tarbell projects.

Configure Amazon S3
-------------------

Generate keys for your Amazon S3 account. Add them during the Amazon S3 section of installation.

To generate keys, log into your `AWS Console <http://aws.amazon.com/>`_, click your name and select<commit_msg>Add note about remote oauth errors<commit_after>============
Installation
============

Install Tarbell with `pip install tarbell`
------------------------------------------

.. code-block:: bash

    pip install -e git+https://github.com/newsapps/flask-tarbell@0.9-beta7#egg=tarbell

.. note::

  Tarbell requires Python 2.7 and Git (v1.5.2+). Tarbell does not currently support Python 3.

  Tarbell does not work on Windows machines.

Configure Tarbell with `tarbell configure`
------------------------------------------

The ``tarbell configure`` command will set up your Tarbell settings

.. code-block:: bash

  tarbell configure

Please consider setting up Google spreadsheet access for collaborative data editing and Amazon
S3 settings for easy publishing.


Configure Google spreadsheet access (optional)
----------------------------------------------

In order to allow Tarbell to create new Google Spreadsheets, you'll need to
download a `client_secrets.json file <https://developers.google.com/api-client-library/python/guide/aaa_client_secrets>`_
to access the Google Drive API. You can share this file with collaborators and
within your organization, but do not share this file anywhere public.

Log in to the `Google API Developer Console <https://cloud.google.com/console/project>`_ and create a new project:

.. image:: create_1_new.png

.. image:: create_1-5_new.png
   :width: 700px


Now click the "APIs & auth" tab. (Click on the "APIs" tab below that if it 
doesn't open automatically.) Enable Google Drive API.

.. image:: create_2_new.png
   :width: 700px


Click the "Credentials" tab (right below "APIs") to create a client ID:

.. image:: create_3_new.png
   :width: 700px


Select "installed app":

.. image:: create_5_new.png
   :width: 700px


Whew! Now you can download the ``client_secrets.json`` file:

.. image:: create_6_new.png
   :width: 700px


The file you download will be called something like 
``client_secret_longstringofrandomlettersandnumbers.apps.googleusercontent.json``.

Rename it to `client_secrets.json`.

Now, you do one of the following:

* Copy ``client_secrets.json`` to ``~/.tarbell/client_secrets.json``.
* Specify the ``client_secrets.json`` download location when running ``tarbell configure``. (By default, Tarbell will attempt to find this file in your ``Downloads`` directory.)

The first time a Tarbell command needs access to a Google spreadsheet (say, while you're running `tarbell configure`), you'll be prompted to
authenticate

.. code-block:: bash

  Go to the following link in your browser:

      https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=705475625983-bdm46bacl3v8hlt4dd9ufvgsmgg3jrug.apps.googleusercontent.com&access_type=offline

  Enter verification code: 

Follow the link:

.. image:: create_7_new.png

You should receive a confirmation code:

.. image:: create_8.png


Enter it. If it works, you'll see:

  Authentication successful.

Now you can access and create Google spreadsheets to use with Tarbell projects.

.. note::

    You need to visit the authentication page from the same machine that you are configuring Tarbell
    in order to avoid an OAuth Error. If you are using a remote machine, consider using the Lynx terminal 
    browser. Alternatively, you can `pre-authenticate <remote-configuration.rst>`.

Configure Amazon S3
-------------------

Generate keys for your Amazon S3 account. Add them during the Amazon S3 section of installation.

To generate keys, log into your `AWS Console <http://aws.amazon.com/>`_, click your name and select
{'fraction_non_alphanumeric': 0.1326676176890157, 'fraction_numerical': 0.019686162624821684, 'mean_word_length': 3.6003937007874014, 'pattern_counts': {'":': 2, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6404618', 'n_tokens_mistral': 2165, 'n_tokens_neox': 2005, 'n_words': 754}