Skip to main content

pyfnalsnow

This module provides Python libraries and scripts to interact with Service Now. This was designed to work with a specific instance of SNOW (FNAL), but these scripts and libraries will probably work with other sites, so it's worth sharing.

Scripts

Create: snow-incident-create, snow-ritm-create

Create Incidents and Requests/Requested Items, respectfully. These work directly with the REST API.

Read: snow-incident-list, snow-ritm-list, snow-tkt, snow-tkt-list

Scripts to search and list Incident and Requested Items, respectfully. snow-tkt-list calls both.

snow-tkt takes a ticket name and prints information about that ticket on STDOUT.

Update: many scripts

Most of these do what they say on the tin:

  • snow-tkt-assign - assign a ticket to a user and/or group
  • snow-tkt-journal - record a journal entry or comment to a ticket
  • snow-tkt-pending - set a ticket to status pending (mostly for RITMs)
  • snow-tkt-resolve - resolve a ticket
  • snow-tkt-unassign - assign a ticket back to the Help Desk

Delete: No Such Thing

Data doesn't generally get removed from SNOW, at least not by users.

libraries

pyfnalsnow

Creates and caches the connections to SNOW; caches searches; provides the CRUD interface that the various scripts depend on; provides tools for user/group searches; abstracts out the various ticket types (Incidents, Requests, Tasks, Requested Items, etc); and works with a central configuration file (/etc/snow/config.yaml) so that we can abstract server/authentication data away from the user.

pyfnalsnow.ticket

This mostly provides template functions for the various sub-tables (e.g. Incident): printing functions, mapping some functions to field names, etc.

pyfnalsnow.Incident, pyfnalsnow.Request, pyfnalsnow.RITM

Functions that must be customized per-table are stored here; for instance, RITMs must change state several times to get to a pending or resolved state.

Requirements

This script requires pysnow. I would probably just update it directly except that I don't know for sure what changes we have made locally that don't apply to the "default" instance.

To make this work on RHEL6 and a modern pysnow you probably want to install oauthlib 2.0.7: pip install oauthlib==2.0.7.

Configuration File

/etc/snow/config.yaml looks something like:

servicenow:
    username: '(USERNAME)'
    url:      'https://(SITENAME).servicenowservices.com/'
    password: '(PASSWORD)'
    hostname: '(SITENAME).servicenowservices.com'

ritm_template:
    priority: '3'
    u_categorization: 'Hardware -- Worker Node -- No Item Available'
    urgency: '3'

Release files for pyfnalsnow 1.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfnalsnow 1.4.5
File Size Uploaded
pyfnalsnow-1.4.5.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyfnalsnow 1.4.5
File Interpreter ABI Platform
pyfnalsnow-1.4.5-py3-none-any.whl Python 3 none any Details

Total release size: 24.6 kB

Release files / pyfnalsnow-1.4.5.tar.gz

Download URL pyfnalsnow-1.4.5.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
095ef5a80e8732ddbc954bb3e741b6fa4a3865cb1ec1a99d0d62806e762287db
BLAKE2b-256 checksum
How to use checksums
3275937674d6582367716a6c161592a6cb9951c00333876e6a45a800ff6dde67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release files / pyfnalsnow-1.4.5-py3-none-any.whl

Download URL pyfnalsnow-1.4.5-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f65fe03ffecc6cfeaf97e0176523f4dcb5c0f35f5300f3373e573fbc9caa2e0
BLAKE2b-256 checksum
How to use checksums
fd8e21e308af9e14fb6009011da9ed0cadd3830514d0f83e835f9486a155c764
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

1.4.5 This release

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.2.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page