Note: WSGI is compatible with most of the popular Python web frameworks, including Flask, Bottle and web2py.
Ensure that nodejs v16 is installed on your system and available on the executable PATH. The current APImetrics adaptor does most of its work in a separate nodejs process.
Download the APImetrics adaptor, darkspark_python_wsgi-0.1.0.tar.gz, and unzip it into your Python project directory.
Add the APImetrics adaptor to your WSGI application, providing an API Key from APImetrics. To create a new API Key for APImetrics by following the tutorial here and choosing Ingress as your Access Level. For example, if you are using Flask, it would look like the following:
from flask import Flask
from darkspark_python_wsgi import darkspark
app = Flask("example")
app.wsgi_app = darkspark(app.wsgi_app, "DARKSPARK-API-KEY")
This completes the setup. The next time you deploy your application, incoming API calls will be captured by the Inventory.
Updated 3 months ago