ServiceNow api client in python

pip install snowclient==0.4.4


Python Api client for Service Now.

Api client for the docs table api.


See an example in the docs dir. tl;dr -

  # re-tailor for your own uses (tablename here is 'incident', base url, auth, etc)
  client = Client("", user, password)
  recent_incidents = client.list("incident", sysparm_limit=1000, sysparm_query=build_query())
  i = recent_incidents[0]
  i.u_custom_field # returns custom value

You'll probably want to use the querybuilder to avoid having to do this yourself.

def build_query():
    qb = QueryBuilder()
    qb.between(start, end)
    return qb.return_query
    # there are more things available:
    # qb.field_equals("bar", "baz")
    # see more examples at test cases

    # returns the kind of stuff that you'll never want to write
    # by and that service now likes, such as
    # sysparm_query=sys_created_onBETWEENjavascript:gs.dateGenerate('2013-12-31','00:00:00')@javascript:gs.dateGenerate('2014-01-01','00:00:00')^ORDERBYDESCsys_created_on


shai@adsk-lappy ~   % pip3.4 install snowclient
Collecting snowclient
  Downloading snowclient-0.3.1.tar.gz
  Running install for snowclient
Successfully installed snowclient-0.3.1


Per (depends on ~/.pypirc file).

It's at


Use something like "~/.snow-auth.json", either way load up basic auth and use Client() class to start hacking away. Or you can just pass it in. You'll also want/need to use the QueryBuilder to abstract away some of the nastiness of the original syntax necessary. See QueryBuilder tests for it's usage.


# or DEBUG=1 nosetests -s for python requests debugging
# use --nocapture if you want to drop into pdb
# or for more verbose nosetests -vvs tests/
# ultimately though:
$ nosetests
Ran 1 test in 0.003s


I'm using it, but consider it WIP. I built only the parts of the api I needed so this is not complete.

It will be over time if it gets the TLC it needs. Contributions very welcome of course.

Hope you find it helpful!

Api docs

Other docs: