Using Spotless with Python

You can easily use Spotless in your python applications by using the pyspotless library.

The code is open source and you can download it here: https://bitbucket.org/tom-weiss/pyspotless

You can also view detail on pypi: https://pypi.python.org/pypi/pyspotless

Installation

You can install pyspotless by running

pip install pyspotless


Usage

1. Get your access token by going to https://spotlessdata.com/api/ when you are logged in
2. Get the URL of a plan you want to run from https://spotlessdata.com/plans/
3. Write the following python code:

from pyspotless import SpotlessClient

spotless = SpotlessClient(access_token='<SPOTLESS TOKEN HERE>')

def callback(job, id):
    clean_file = spotless.get_processed_file(job)
    # now do something with the file
    spotless.delete_job(job)

spotless.run_job("https://spotlessdata.com/plans/<PLAN ID HERE>", "my_dirty_file.csv", callback, "my identifier")

4. Do some cleansing