Package to serialize python dictionaries/JSON into URI GET parameters, and reverse.
Project description
JSONURI-PY
This package helps you convert Python dictionaries into an HTTP GET request parameters, and vice-versa.
An example of a practical application would be to send JSON data over HTTP GET, e.g. to a static resource small.png, and harvest the data from access logs instead of running real-time data collection.
Note: You should avoid send sensitive information using this mechanism, or at least ensure you send your data over SSL.
Equivalent libs/packages:
JavaScript: [jsonuri-js](https://bitbucket.org/guidj/jsonuri-js)
PHP: [jsonuri-php](https://bitbucket.org/guidj/jsonuri-php)
Examples:
Serialization:
`python >>> import json >>> import urllib.parse >>> from jsonuri import jsonuri >>> jsonuri.serialize(json.loads('{"age": "31", "name": "John"}')) 'age%3D31%26name%3DJohn' >>> jsonuri.serialize(json.loads('{"age": "31", "name": "John"}'), encode=False) 'age=31&name=John' `
Desirialization
`python >>> string = "name=John&age=31" # or "name%3DJohn%26age%3D31" >>> jsonuri.deserialize(string) {'age': '31', 'name': 'John'} `
Notes
The package was not designed to process HTML form data, specifically multi-value variables, i.e. from select attributes. Though if you convert the data to a JSON/JavaScript object, that should work.
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
Built Distribution
Hashes for jsonuri-0.1.21.macosx-10.9-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6b48b1555d16890b888e832356b24409c878b294b7465dd5fc088f13e902174 |
|
MD5 | 37e54b97b0164b960189e0e83325ce98 |
|
BLAKE2b-256 | 68d8bb6cc918b8e490dcd68f414088fdb1bfdfc5221d8161fd0afd2ffb65d6fa |