This sample app will show you how to use XD Cloud APIs in Python using the Flask framework.
After setting up the sample, you will have a Python app that:
- Serves
templates/index.html
onhttps://localhost:8000
- Lets a user input a cloud document ID
- Returns the metadata of the cloud document
You can find a companion repo for this developer guide on GitHub.
Be sure to follow all instructions in the readme
.
- Python 2.6 or greater and the
pip
package manager - OpenSSL CLI
This guide will assume that you have read the Adobe OAuth 2.0 Guide for Web.
You must also have an API key by registering your app with us.
The following steps will help you get this sample up and running.
This example requires SSL, so you will need to create a self-signed cert using the OpenSSL CLI:
$ openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
Make sure that after running this command you have the cert.pem
and key.pem
files at the top level of the sample app.
This sample app uses the Flask, Requests, and Six libraries. You can install them using the pip
package manager:
$ pip install flask
$ pip install requests
$ pip install six
Enter the required credentials in config.py
:
class Config(object):
FLASK_SECRET = 'PLACEHOLDER_SECRET_KEY'
API_KEY = 'YOUR_API_KEY'
ACCESS_TOKEN = 'YOUR-ACCESS-TOKEN'
You can get your API Key by contacting us. Note that ACCESS_TOKEN
is only required if your application is going to access private XD cloud documents. In order to get the ACCESS_TOKEN
, your app has to integrate Adobe IO OAuth workflow.
After completing the configuration steps, run adobe-xd-cloud.py
:
$ python adobe-xd-cloud.py
To access the app, go to https://localhost:8000
. Click through any cert warnings in the browser.