skip to navigation
skip to content

pyjsend 0.2.1

A python jsend library

Package Documentation

python jsend pypi: https://pypi.python.org/pypi/pyjsend/

Install

pip install pyjsend

Usage

import module:

>>> import jsend

success:

>>> jsend.success({'key': 'value'})
{'status': 'success', 'data': {'key': 'value'}}

fail:

>>> jsend.fail({'key': 'value'})
{'status': 'fail', 'data': {'key': 'value'}}

error:

>>> jsend.error('message')
{'status': 'error', 'message': 'message'}

is success:

>>> jsend.is_success({'status':'success'})
True

is fail:

>>> jsend.is_fail({'status':'fail'})
True

is error:

>>> jsend.is_error({'status':'error'})
True

to json string and load jsend string:

>>> jsend.success({'key': 'value'}).stringify()
'{"status": "success", "data": {"key": "value"}}'

>>> jsend.loads(jsend.success({'key': 'value'}).stringify())
{u'status': u'success', u'data': {u'key': u'value'}}
 
File Type Py Version Uploaded on Size
pyjsend-0.2.1-py2.py3-none-any.whl (md5) Python Wheel 2.7 2017-01-05 3KB
pyjsend-0.2.1.tar.gz (md5) Source 2017-01-05 3KB