Skip to main content

Bynder SDK can be used to speed up the integration of Bynder in Python

Project description

Bynder Python SDK

Build Status

The main goal of this SDK is to speed up the integration of Bynder customers who use Python. Making it easier to connect to the Bynder API (https://bynder.docs.apiary.io) and execute requests on it.

Note: As of version 1.0.0 this SDK now uses OAuth 2.0. For the last version using OAuth 1.0a please refer to version 0.0.6.

Requirements and dependencies

The Python SDK requires the following in order to fully work:

  • Python >= 3.5, older versions of Python won't work.

Pip should handle all the dependencies automatically.

Installation

This SDK depends on a few libraries in order to work, installing it with pip should take care of everything automatically.

Before you install the SDK we recommend you to setup a virtual environment:

virtualenv -p python3 venv  # create virtual environment
source venv/bin/activate    # activate virtual environment

After you have successfully setup a virtual environment you can install the SDK with pip. Run the following command while your virtual environment is active.

pip install bynder-sdk

Getting started

This is a simple example on how to retrieve data from the Bynder asset bank. For a more detailed example of implementation refer to the sample code.

First import the BynderClient:

from bynder_sdk import BynderClient

When using OAuth2, create an instance of the client and use the flow to receive a token:

bynder_client = BynderClient(
    domain='portal.getbynder.com',
    redirect_uri='https://...',
    client_id='',
    client_secret='',
    token_saver=token_saver
)

print(bynder_client.get_authorization_url())
code = input('Code: ')
bynder_client.fetch_token(code)

When using a permanent token, the client instance can be created like this:

bynder_client = BynderClient(
  domain='portal.getbynder.com',
  permanent_token=''
)

Finally call one of the API's endpoints through one of the clients:

asset_bank_client = bynder_client.asset_bank_client
media_list = asset_bank_client.media_list({
    'limit': 2,
    'type': 'image'
})

A full list of the currently available clients and methods in the SDK can be found below

Methods Available

These are the methods currently availble on the Bynder Python SDK, refer to the Bynder API Docs for more specific details on the calls.

BynderClient:

Get an instance of the Asset Bank Client or the Collection Client if already with access tokens set up. Also allows to generate and authenticate request tokens, which are necessary for the rest of the Asset Bank and Collection calls.

asset_bank_client
collection_client
pim_client
workflow_client
get_authorization_url()
fetch_token()
derivatives()

asset_bank_client:

All the Asset Bank related calls, provides information and access to Media management.

brands()
tags()
meta_properties()
media_list(query)
media_info(media_id, query)
media_download_url()
set_media_properties(media_id, query)
delete_media(media_id)
create_usage(itegration_id, asset_id, query)
usage(query)
delete_usage(integration_id, asset_id, query)
upload_file(file_path, brand_id, media_id, query)

With the upload_file method you can do two things. You can upload a new asset, or you can upload a new version of an exising asset. You can control this by sending a media_id or not.

collection_client:

All the collection related calls.

collections(query)
collections_info(collection_id)
create_collection(name, query)
delete_collection(collection_id)
collection_media_ids(collection_id)
add_media_to_collection(collection_id, media_ids)
remove_media_from_collection(collection_id, meedia_ids)
share_collection(collection_id, collection_option, recipients, query)

pim_client:

All the PIM related calls.

metaproperties()
metaproperty_info(metaproperty_id)
metaproperty_options(metaproperty_id)
edit_metaproperty_option(metaproperty_option_id, children)

workflow_client:

All the workflow related calls.

users()
campaigns(query)
campaign_info(campaign_id)
create_campaign(name, key, description, responsibleID, query)
delete_campaign(campaign_id)
edit_campaign(campaign_id, name, key, description, responsibleID, query)
metaproperties()
metaproperty_info(metaproperty_id)
groups()
group_info(group_id)
job_preset_info(job_preset_info)
jobs(campaign_id)
create_job(name, campaignID, accountableID, presetID, query)
job_info(job_id)
edit_job(job_id, name, campaignID, accauntableID, presetID, query)
delete_job(job_id)}

Tests

You can run the tests by using the command below. This will install the packages required and execute the tests for all the clients.

make test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bynder_sdk-1.1.4-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file bynder_sdk-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: bynder_sdk-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for bynder_sdk-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fe2e1fdbe68198277695e711b135c6a90ef7ebdb63c2d4c8a907be1c28e29a9f
MD5 32d4233e06bec7d61e0e97705e656bbb
BLAKE2b-256 e3db6dcd8ff6be71ed150b54e223bee6b049fcf6505d360ce0574cb923dc64d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page