Pysnow extension for Flask
Project description
flask-snow
Build apps on top of the ServiceNow REST API using the lightweight Flask microframework
Uses the pysnow library.
Supports OAuth for a seamless authentication / authorization experience.
Installation
$ pip install flask-snow
Documentation
The documentation can be found here
Usage
Minimal server. Does the following:
Sets config
Creates Snow instance
Queries the incident table by number
Returns JSON representation of the result
from flask import Flask, jsonify
from flask_snow import Snow
app = Flask(__name__)
app.config['SNOW_INSTANCE'] = '<instance name>'
app.config['SNOW_USER'] = '<user name>'
app.config['SNOW_PASSWORD'] = '<password>'
snow = Snow(app)
@app.route('/incidents/<number>')
def incident(number):
incident = snow.resource(api_path='/table/incident')
response = incident.get(query={'number': number}).one_or_none() or {}
return jsonify(response)
if __name__ == '__main__':
app.run()
Name it server.py and run with python server.py
Check out the examples for more!
Compatibility
Python 2 and 3
Flask > 0.9
JetBrains
Thank you Jetbrains for creating pycharm and for providing me with free licenses
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flask-snow-0.2.5.tar.gz
(4.5 kB
view hashes)