sorrek-dataroom 1.0.4
For use with the Sorrek Dataroom product
Requires Python: >=3.7

Introduction
============

`Sorrek <http://www.sorrek.io>`__ is a data intelligence tool and this is a python library to simplify access to the `Onehub API <https://developer.onehub.com/>`__.

Onehub is a third party SFTP portal, used to host your files. Onehub is a secure file hosting service that meets the compliance standards of various certifications and third-party attestations including: SSAE 16, PCI DSS Level 1, ISO 27001, FISMA, and SOC 2.

Installation
============

sorrek-dataroom releases are available as wheel packages for macOS, Windows and Linux on PyPI. Install it using ``pip``:

.. code-block:: bash


    python -m pip install -U pip
    python -m pip install -U sorrek-dataroom

Setup
=====

You will first need to `create a developer account <https://ws.onehub.com/signups/new?plan_name=developer&return_to=%2Fhome>`__. Then navigate to "Developer" and then click on "Create OAuth Client". Name your client and then use "https://localhost" for both the Application URI and the Redirect URI. Once the client is created make sure to save your client_id and client_secret in a secure location.

**Note:** To request access to your workspace please contact your account manager.

After creating the client, you will need to authenticate your application. You can do this by generating a URL using the ``get_auth_url`` method:

.. code:: py

	import sorrek_dataroom.api as sorrek

	sorrek.get_auth_url(client_id)

Open the printed URL in a web browser and click "Approve". The webpage will reload to a failed page, which is expected. Copy the URL it redirects to and pass it through to the ``store_access_token`` method:

.. code:: py

	import sorrek_dataroom.api as sorrek

	sorrek.store_access_token(url, client_id, client_secret)

This will store the required access token locally.

Usage
=====

Uploading csv files to the Dataroom
-----------------------------------
Use the ``upload_csv_file`` method:

.. code:: py

    import sorrek_dataroom.api as sorrek

    sorrek.upload_csv_file(folder_id, upload_file_path)

Downloading csv files in the Dataroom as dataframes
---------------------------------------------------
Use the ``download_csv_to_df`` method:

.. code:: py

    import sorrek_dataroom.api as sorrek

    sorrek.download_csv_to_df(file_id)

Deleting files in the Dataroom
------------------------------
Use the ``delete_file`` method:

.. code:: py

    import sorrek_dataroom.api as sorrek

    sorrek.delete_file(file_id)

Renaming files in the Dataroom
------------------------------
Use the ``rename_file`` method:

.. code:: py

    import sorrek_dataroom.api as sorrek

    sorrek.rename_file(file_id, new_file_name)

Getting file metadata
---------------------
Use the ``get_file_metadata`` method:

.. code:: py

    import sorrek_dataroom.api as sorrek

    sorrek.get_file_metadata(file_id)

Getting folder contents
-----------------------
Use the ``get_folder_contents`` method:

.. code:: py

    import sorrek_dataroom.api as sorrek

    sorrek.get_folder_contents(folder_id, sort, offset)

**Note:** Offset is an optional parameter (default 0) that can be used to paginate results. 

FAQs
====
Where can I find a folder_id or file_id?
----------------------------------------
-  You can find this in the URL for the folder/file.

How can I upload/download files that aren't csv's?
--------------------------------------------------
-  The purpose of this python library is to simplify automating your Sorrek Dataroom integration. Since we use csv files exclusively, you will need to develop your own functions to upload non-csv file types. There are more details available in the `Onehub API Documentation <https://developer.onehub.com/>`__.

Can I do other things with the API, like download a full folder?
----------------------------------------------------------------
-  The purpose of this python library is to simplify automating your Sorrek Dataroom integration. For additional API endpoints and operations check out the `Onehub API Documentation <https://developer.onehub.com/>`__.