Package: shutterstock-cli
shutterstock-cliA command-line utility that allows you to interact with the Shutterstock public API. For more information about the CLI and the API, see theShutterstock API reference.InstallationThe Shutterstock CLI is available on thePython Package Index (PyPI). You can install it using pip.pipinstallshutterstock-cliAuthenticationBasic authenticationAll endpoints in the Shutterstock API require authentication.
The API accepts HTTP basic authentication for some endpoints and OAuth authentication for all endpoints.The API accepts HTTP basic authentication (also known asbasic authentication) for some endpoints that do not access specific customer information.
Follow these steps to use basic authentication:Create an account athttps://www.shutterstock.comif you don't already have one.Set up an application athttps://www.shutterstock.com/account/developers/appsand get the consumer key and consumer secret from the application.Export the consumer key and consumer secret as environment variables:exportSHUTTERSTOCK_KEY='YOUR_KEY'exportSHUTTERSTOCK_SECRET='YOUR_SECRET'OAuth authenticationMost endpoints require OAuth 2.0 authentication.
In this type of authentication, you use an application and an individual user's login credentials to obtain a token.
Then you can use that token as credentials for API requests in place of a user name and password.Some endpoints require one or morescopes, or permissions, which let the user control what the application can do with the token.
For example, to edit a user's collections, the token must include thecollections.editscope.
Applications can request multiple tokens with different scopes or a single token with multiple scopes.Getting tokens from your account pageAs a shortcut, you can get a token directly from an application on your account page:Create an account athttps://www.shutterstock.comif you don't already have one.Set up an application athttps://www.shutterstock.com/account/developers/apps.On the application details page, underToken, clickGenerate token.On the Select scopes page, select the scopes for the token.
The token automatically has scopes that allow it to run basic tasks.
You can add scopes that allow it to access your licenses and collections.ClickContinue.In the popup window, sign in to your shutterstock.com account.The popup window shows the token. Copy it immediately, because it is shown only once.
The token is valid until the user account that you logged in with changes its password or email address.Keep this token private, because other people could use it to access the account's subscriptions and media.To use this token to authenticate your CLI commands, set it as the value of theSHUTTERSTOCK_API_TOKENenvironment variable:exportSHUTTERSTOCK_API_TOKEN='YOUR_BEARER_TOKEN'UsageRunshutterstock --helpto see the available commands. You can also run shutterstock groupName --help or shutterstock groupName commandName --help to get help on a group of commands or on an individual command.Usage:shutterstock[OPTIONS]COMMAND[ARGS]Options:--helpShowthismessageandexit.

Commandsareorganizedintothesegroups.Togetalistofcommandsinagroup,runshutterstockgroupName--help.

Groups:aiaudiocontributorscveditorialimagestestuservideosFormatting JSON OutputIf you would like to colorize the JSON response output you can set theSHUTTERSTOCK_CLI_COLORIZE_OUTPUTenvironment variable:exportSHUTTERSTOCK_CLI_COLORIZE_OUTPUT='true'SandboxTo make requests to the licensing sandbox API instead of the main API, set theSHUTTERSTOCK_SANDBOXenvironment variable to true.For more information about the sandbox, seehttps://api-reference.shutterstock.com/#licensing-and-downloading-licensing-sandbox.exportSHUTTERSTOCK_SANDBOX='true'ExamplesSearch for images of boats with an aspect ratio of 1.6.shutterstockimagessearch-images--queryboats--aspect-ratio1.6Get information about an image, including a URL to a preview image and the sizes that it is available in.shutterstockimagesget-image1269188995Get a list of existing image licenses for a specified time period.shutterstockimagesget-image-license-list--start-date2020-03-03T12:00:00Z--end-date2020-03-04T12:00:00ZGet images that are visually similar to an image that you specify.shutterstockimagesget-similar-images1269188995--languageen--per-page200--viewminimalLicense an image.shutterstockimageslicense-imagespath/to/payload.json--subscription-ids123abcGet your image license history over a specified time period.shutterstockimagesget-image-license-list--start-date2021-01-01T12:00:00Z--end-date2021-03-01T12:00:00ZGet the public URL of the image that you have already received a license for.shutterstockimagesdownload-imagelicense-id-123payload.jsonFor more examples, see theShutterstock API reference.DevelopmentCreating virtual environmentpython3-mvenv[NAME_FOR_YOUR_VIRTUAL_ENV]Activating virtual environmentsource[NAME_FOR_YOUR_VIRTUAL_ENV]/bin/activateInstall app in virtual environmentpythonsetup.pyinstallInstall the requirementspip3install-rrequirements.txtUtilize installed appshutterstock--helpDeactivating virtual environmentYou can deactivate the virtual environment by simply running the command below.deactivateRunning Testscoverage run --omit 'env/*' -m unittest tests/*.py && coverage report -mContributingFork the project and clone locally.Create a new branch for what you're going to work on.Push to your origin repository.Create a new pull request in GitHub.