Skip to main content

A wrapper with a couple of utility functions for the Unleashed Software API

Project description

PyUnleashed

PyUnleashed is a Python library for interacting with the Unleashed Software (www.unleashedsoftware.com) API in a Pythonic manner. This is a work in progress

Installation

Use the package manager pip to install PyUnleashed.

pip install pyunleashed

Then install the requests library if it isn't already.

pip install requests

Usage

from PyUnleashed import API

unlapi =  API(
            url = 'https://api.unleashedsoftware.com/',
            api_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
            api_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
)


# GET a product
r = unlapi.get("Products", ProductCode="TESTSKU")

# You can also optionally include filters as additional arguments for example
r = unlapi.get("Products", includeAttributes="True", pageSize=5)

# Some results could need pagination and you can request using
r = unlapi.get("Products", includeAttributes="True", pageSize=5)
string_r = json.dumps(r)
json_r = json.loads(string_r)

# Total items, pages etc are available
print(json_r['Pagination']['NumberOfItems'])
print(json_r['Pagination']['NumberOfPages'])
print(json_r['Pagination']['PageNumber'])
print(json_r['Pagination']['PageSize'])

# POST a product (remember to include the uuid in the URL, in this case it's the order number, data_payload is a valid Python dict)
r = unlapi.post("SalesOrders/{0}".format(order_number), data=data_payload)

# There are also two help functions to convert between date formats

# Create a Python datetime from UNL date string
print(unlapi.dateFromUnl('/Date(1550573963258)/'))

# Create a timestamp from datetime either leave blank for now or enter your own date
print(unlapi.dateToUnl())

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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

PyUnleashed-1.0.6.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyUnleashed-1.0.6-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file PyUnleashed-1.0.6.tar.gz.

File metadata

  • Download URL: PyUnleashed-1.0.6.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for PyUnleashed-1.0.6.tar.gz
Algorithm Hash digest
SHA256 cebbb36aa088067408289b2046eaf2047d7278795836206889a1f297fa8ca735
MD5 6db4536ffe64e166dfdb04fa1713ffba
BLAKE2b-256 d4a5bb96b64939f297bb7c29240d278c838529a1b16353e98f31a9e304c4b16a

See more details on using hashes here.

File details

Details for the file PyUnleashed-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: PyUnleashed-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for PyUnleashed-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8a3b26a8930a34bdda2fc9ea63ddce9b612348ab1e6121771ef5430507919f31
MD5 efca124f637145d466750122811940b6
BLAKE2b-256 9b49a137ff5eb3db249fb90bd51acac59cc8920f8eca912b2cd254132ff34e60

See more details on using hashes here.

Supported by

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