Library for obtaining image Auth Token from MyDesign99 for python and django servers
Project description
Image Authentication SDK from MyDesign99
Use the Image Authentication SDK from MyDesign99 on your server to build fully formatted URL's for your MyDesign99 images.
To be used on your Python or Django server
Link to the python package index (PyPI)
pypi.org/project/md99authtoken/1.1.1/
OVERVIEW
MyDesign99 requires that image requests use authenticated tokens in the fully-formed URL as a part of your own designs and websites. This SDK is used to retrieve the latest token for your account and to format the URL.
Example:
https://mydesign99.com/abcd1234/wxyz5678asdf9876/78/first-asset.png
The normal usage of the SDK is to have it embedded on your own server. Then you would use your own database to retrieve values and the SDK to retrieve an Auth Token. MyDesign99 provides you with a Public Key and a Secret Key. Through your MD99 account, you can create custom designs (graphics). The combination of Public Key, Auth Token, Value, and Asset Name will form a valid URL for an img tag to be placed on your own web pages, reports or PDF files.
Example
Suppose you have a server that maintains a database of high school student grades. You can pass a StudentID to your server, calculate the student's grade average, and return a full URL for the grade and the correct data graphic. Your own data graphics are called "assets" on MyDesign99.
studentID = routeParams[0]
publicKey = config.getConfig("public_key")
secretKey = config.getConfig("secret_key")
score = database.getStudentScore(studentID) # some database funtion on your server
assetName = "radial-wedges"
# call the MD99 SDK
imageUrl = md99authtoken.processAll (publicKey, secretKey, score, assetName)
Use in conjunction with our Python Server Demo (md99demo)
The MyDesign99 Python server demo (md99demo) responds to 2 different URLS to create an authenticated MD99 image URL. URL #1 contains the "value" and "asset_name" in the full URL. URL #2 uses POST parameters "value" and "asset_name".
The demo uses this SDK package to communicate with the MyDesign99 servers.
USAGE
Before using this SDK, the python developer needs to request a "demo" pair of public/secret keys or use the public/secret keys associated with an existing MyDesign99 account.
There are 4 function in this SDK package.
getMD99AuthToken (publicKey, secretKey)
createImageURL (publicKey, token, value, assetName)
errorImageURL ()
processAll (publicKey, secretKey, value, assetName)
getMD99AuthToken (publicKey, secretKey)
Request the current authentication token. The developer's public and secret keys are required.
createImageURL (publicKey, token, value, assetName)
Create a well-formed URL for the requested image. "publicKey" can be found in the MD99 portal. "token" is retrieved using the "getMD99AuthToken" function. "value" is the numeric value to be displayed in the MD99 graphic. "assetName" is the name of the developer's MD99 asset (graphic) to be displayed.
errorImageURL ()
Create a well-formed URL for the standard MD99 error image.
processAll (publicKey, secretKey, value, assetName)
Request the current authentication token and return the well-formed image URL. In case of an error, the Error Image URL is returned.
Installation
To install this Python package:
pip install md99authtoken
To use it in a Python script or interactive shell:
from md99authtoken import md99authtoken
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file md99authtoken-1.1.2.tar.gz.
File metadata
- Download URL: md99authtoken-1.1.2.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26551502992763243963704000d611f46268ff0937a478d9ed7b636d675155e3
|
|
| MD5 |
4765c8cb4acfb923449ac754b3149964
|
|
| BLAKE2b-256 |
a43401f1a4c6dacc453508384e2f4b15d46307a7bcb45883023dda71aa7a687e
|
File details
Details for the file md99authtoken-1.1.2-py3-none-any.whl.
File metadata
- Download URL: md99authtoken-1.1.2-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c3ff7a8b7ed4cc11e3dcb81235174f007e9f34ea32d28a9209762bf9ceac5ef
|
|
| MD5 |
adce69876796c1df23072cf084370984
|
|
| BLAKE2b-256 |
43cf76d4b66e763d8a26b6d6b0a2d01a63a64dea3e54ec174d988f44a89d447c
|