Package: autoretouch
autoRetouch clientInstallationPrerequisites: Sign up for free athttps://app.autoretouch.com.from pypipipinstallautoretouchfor developmentclone this repo and thenpip install -e .CLICLI for interacting withautoretouch: the ai-powered image editing platform.Process images straight from your terminal.Featuresauto-completion for bash, zshUsageUsage: autoretouch [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  balance        show your organization's current balance
  config         configure/show which organization and workflow are used by default
    get          show the organization and workflow that are currently used by default
    set          configure the organization and/or workflow that are used by default
  login          authenticate with your autoretouch account
  logout         revoke and remove stored refresh token from disk
  organization   show details of given organization
  organizations  list all your organizations
  process        process an image or a folder of images and wait for the result
  upload         upload an image from disk
  workflows      show workflowspython clientWork in Progress Python client implementation for the most important public API endpoints forhttps://www.autoretouch.com.API documentation:https://docs.api.autoretouch.comUsageThis package exposes a single classAutoretouchClientallowing high- and low-level interactions with the autoRetouch API.High-levelBatchIn most cases, you would like to process images according to some workflow within the scope of an organization.
To do so, you can simplyfromautoretouch.api_client.clientimportAutoRetouchAPIClientfromuuidimportUUIDorganization_id="e722e62e-5b2e-48e1-8638-25890e7279e3"ar_client=AutoRetouchAPIClient(organization_id=organization_id,# by default the client saves and reloads your credentials here:credentials_path="~/.config/autoretouch-credentials.json")workflow_id="26740cd0-3a04-4329-8ba2-e0d6de5a4aaf"input_dir="images_to_retouch/"output_dir="retouched_images/"# starts a thread for each image and download the results to output_dirar_client.process_folder(input_dir,output_dir,UUID(workflow_id))NoteGet yourorganization_idfromhttps://app.autoretouch.com/organization> Copy Organization ID.Get yourworkflow_idfromhttps://app.autoretouch.com/workflows>⋮> Workflow API Information > id.Single ImageIf you wish to process a single image with a workflow, you can dofromautoretouch.api_client.clientimportAutoRetouchAPIClientfromuuidimportUUIDorganization_id="e722e62e-5b2e-48e1-8638-25890e7279e3"ar_client=AutoRetouchAPIClient(organization_id=organization_id,# by default the client saves and reloads your credentials here:credentials_path="~/.config/autoretouch-credentials.json")workflow_id="26740cd0-3a04-4329-8ba2-e0d6de5a4aaf"output_dir="retouched_images/"ar_client.process_image("my_image.png",output_dir,UUID(workflow_id))This is the method called internally byproces_batch. It willupload the imagestart an executionpoll every 2 seconds for the status of the executiondownload the result tooutput_diror returnFalseif the execution failedThis is the recommended way to efficiently process images through our asynchronous api.AuthenticationTheAutoRetouchAPIClientauthenticates itself with thedevice flowofauth0.
Upon instantiation of the client, you can configurewhether credentials should be persisted or not throughsave_credentials=where credentials should be persisted/loaded from throughcredentials_path=If you don't pass acredentials_path, the client will first check if you passed arefresh_tokenwith which it can obtain credentials.If this argument is alsoNone, the client will trigger a device flow from the top.
It will open a window in your browser asking you to confirm a device code.
The client will be authenticated once you confirmed.By default,credentials_pathandrefresh_tokenareNonebutsave_credentials=True.
The first time you use the client, this triggers the device flow and saves the obtained credentials to~/.config/autoretouch-credentials.json.
After that, it automatically falls back to this path and authenticates itself without you having to do anything :wink:Low-level Endpointsfor finer interactions with the API, the client exposes methods corresponding to endpoints.TODO: table withmethod name & signature | api docs link