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:

You can also view detail on pypi:


You can install pyspotless by running

pip install pyspotless


1. Get your access token by going to when you are logged in
2. Get the URL of a plan you want to run from

3. Write the following python code:

spotless = SpotlessClient(access_token='<SPOTLESS TOKEN HERE>')
job = spotless.run_job("<PLAN ID HERE>", "my_dirty_file.csv")

# wait for the job to complete
while not job["processing_complete"]:
    job = spotless.get_job(job["url"])

# get the processed file and ensure it works
file = spotless.get_processed_file(job)

Callback option

If you are using a multi-threaded environment you can use the callback option

from pyspotless import SpotlessClient

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

spotless = SpotlessClient(access_token='<SPOTLESS TOKEN HERE>')
spotless.run_job("<PLAN ID HERE>", "my_dirty_file.csv", callback, "my identifier")