Skip to main content

Python library for the ServiceNow REST API

Project description

https://travis-ci.org/rbw0/pysnow.svg?branch=master https://coveralls.io/repos/github/rbw0/pysnow/badge.svg?branch=master

pysnow

Python library for the ServiceNow REST API focused on ease of use, simple code and elegant syntax.

The REST API is active by default in all instances, starting with the Eureka release.

Documentation

Click here to see the documentation

Installation

# pip install pysnow

Basic usage

import pysnow

# Create client object
s = pysnow.Client(instance='myinstance',
                  user='myusername',
                  password='mypassword',
                  raise_on_empty=True)

# Create a new record
s.insert(table='incident', payload={'field1': 'value1', 'field2': 'value2'})

# Create a `Request` object by querying for 'INC01234' on table 'incident'
r = s.query(table='incident', query={'number': 'INC01234'})

# Fetch one record and filter out everything but 'number' and 'sys_id' from the results
r.get_one(fields=['number', 'sys_id'])

# Update
r.update({'this': 'that'})

# Delete
r.delete()

# Iterate over all records with state == 2 and print out number
for record in s.query(table='incident', query={'state': 2}).get_all():
    print(record['number'])

See the documentation for more examples and other info

Compatibility

pysnow is compatible with both Python 2 and 3. Tested: 2.7, 3.3, 3.4, 3.5

Fails in some versions of 2.6 due to SSL issues. https://github.com/kennethreitz/requests/issues/2022

Author

pysnow was created by Robert Wikman <rbw@vault13.org> in 2016

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

pysnow-0.2.1.tar.gz (5.4 kB view hashes)

Uploaded Source

Supported by

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