Skip to content

A Python wrapper around the NetSuite OpenAir XML API.

License

Notifications You must be signed in to change notification settings

23maverick23/oaxmlapi

Repository files navigation

oaxmlapi

PyPI Codecov Travis license GitHub top language OpenAir release

DESCRIPTION

oaxmlapi is a Python wrapper around the NetSuite OpenAir XML API. It allows for easier interaction with the XML version of the OpenAir API and reduces the need to generate raw XML. The library is written entirely in Python and utilizes the etree.ElementTree library for producing pre-formatted XML tags and attributes for use in your API requests.

REQUIREMENTS

INSTALLATION

PyPI

Coming soon!

Manual

For Windows, download the latest build here as archive. Unpack the archive and run python setup.py install inside the root directory.

For Linux and Mac OSX, you can use Terminal/iTerm to download, unpack and install.

$ curl -LOk https://github.com/23maverick23/oaxmlapi/archive/master.zip
$ unzip master.zip
$ cd oaxmlapi-master
$ sudo python setup.py install

DOCUMENTATION

BASIC EXAMPLE

The focus of this package is simple - write Python, not XML. Here's an example which uses the urllib2 library to make a simple HTTP request using some XML formatted data.

import urllib2
from oaxmlapi import connections, datatypes, commands

app = connections.Application('test app', '1.0', 'default', 'uniquekey')
auth = connections.Auth('My Company', 'Admin', 'p@ssw0rd')

date = datatypes.Datatype('Date', {'month': '03', 'day': '14', 'year': '2012'})
task = datatypes.Datatype('Task', {'projectid': '13'})

filter1 = commands.Read.Filter('newer-than', 'date', date).getFilter()
filter2 = commands.Read.Filter(None, None, task).getFilter()

xml_data = []
xml_data.append(commands.Read('Task', 'equal to', {'limit': '1000'}, [filter1, filter2], ['id', 'timesheetid']).read())
xml_req = connections.Request(app, auth, xml_data).tostring()

req = urllib2.Request(url='https://www.openair.com/api.pl', data=xml_req)

AUTHORS

Ryan Morrissey - ryancmorrissey.com

About

A Python wrapper around the NetSuite OpenAir XML API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages