evc
evc - a simple wrapper over "requests" HTTP library, which uses json format for transferring, with automatic decoding to the Python dictionary and back when executing HTTP requests to the REST-API server based on the "Eve" framework.
Contents: Installation | Requirements | Running the tests | Example of usage | Versioning | Authors | License
Getting Started
Installation
From pip
pip install --upgrade evc
Manual install
git clone https://github.com/evbg/evc.git
cd evc
python setup.py install
Installing directly from the repository on GitHub.com
pip install git+https://github.com/evbg/evc.git
Requirements
evc requires requests and simplejson libraries.
Running the tests
Evc has been tested on the following versions of Python: 2.7, 3.4, 3.5, 3.6, 3.7, pypy, pypy3.
Integration tests with the Eve framework
Prerequisites
To run tests on a localhost, it is necessary that the MongoDB service is started with access control disabled.
Running the tests via tox tool
git clone https://github.com/evbg/evc.git
cd evc
tox
Example of usage
The following example shows the use of evc through the Python interactive shell:
First, run the server "Eve"
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from eve import Eve
>>> settings = {'XML': False, 'JSON': True, 'SERVER_NAME': '127.0.0.1:5555', 'MONGO_DBNAME': 'evc_test'}
>>> settings['RESOURCE_METHODS'] = ['GET', 'POST', 'DELETE']
>>> settings['ITEM_METHODS'] = ['GET', 'PATCH', 'PUT', 'DELETE']
>>> settings['DOMAIN'] = {'persons': {'versioning': True, 'allow_unknown': True, 'schema': {}}}
>>> app = Eve(settings=settings)
>>> app.run()
* Running on http://127.0.0.1:5555/ (Press CTRL+C to quit)
Second, run the client "Evc"
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from evc import Evc
In [2]: REST = Evc('http://127.0.0.1:5555')
In [3]: type(REST.response)
Out[3]: NoneType
In [4]: REST.get()
Out[4]: {u'_links': {u'child': [{u'href': u'persons', u'title': u'persons'}]}}
In [5]: type(REST.response)
Out[5]: requests.models.Response
In [6]: REST.response.text
Out[6]: u'{"_links": {"child": [{"href": "persons", "title": "persons"}]}}'
In [7]: REST.response.json
Out[7]: <bound method Response.json of <Response [200]>>
In [8]: REST.response.json()
Out[8]: {u'_links': {u'child': [{u'href': u'persons', u'title': u'persons'}]}}
In [9]: REST.post('persons', {'name': 'Bob', 'email': 'bob@bobmail.com'})
Out[9]:
{u'_created': u'Tue, 25 Oct 2016 10:46:39 GMT',
u'_etag': u'90d02265b8d7c832247fcaeacf11d1f4bbf8f0bc',
u'_id': u'580f380fa7a3497495d72bd4',
u'_latest_version': 1,
u'_links': {u'self': {u'href': u'persons/580f380fa7a3497495d72bd4',
u'title': u'Person'}},
u'_status': u'OK',
u'_updated': u'Tue, 25 Oct 2016 10:46:39 GMT',
u'_version': 1}
In [10]: REST.patch('persons', '580f380fa7a3497495d72bd4', '90d02265b8d7c832247fcaeacf11d1f4bbf8f0bc', {'name': 'Bob', 'email': 'bob2@bobmail.com'})
Out[10]:
{u'_created': u'Tue, 25 Oct 2016 10:46:39 GMT',
u'_etag': u'50da6d8e759eeb0a32eaf0bd820dcfb729cdf5d9',
u'_id': u'580f380fa7a3497495d72bd4',
u'_latest_version': 2,
u'_links': {u'self': {u'href': u'persons/580f380fa7a3497495d72bd4',
u'title': u'Person'}},
u'_status': u'OK',
u'_updated': u'Tue, 25 Oct 2016 10:48:20 GMT',
u'_version': 2}
In [11]: REST.delete('persons', '580f380fa7a3497495d72bd4', '50da6d8e759eeb0a32eaf0bd820dcfb729cdf5d9')
Out[11]: u''
In [12]: REST.get('persons', '580f380fa7a3497495d72bd4')
Out[12]:
{u'_items': [],
u'_links': {u'parent': {u'href': u'/', u'title': u'home'},
u'self': {u'href': u'persons', u'title': u'persons'}},
u'_meta': {u'max_results': 25, u'page': 1, u'total': 0}}
Versioning
We use SemVer for versioning.
Authors
- Evgeny V. Bogodukhov - Initial work - evbg
License
This project is licensed under the MIT License - see the LICENSE file for details
Metadata
Release files for evc 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| evc-0.6.1.tar.gz | 9.0 kB | Without provenance | Details for evc-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| evc-0.6.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for evc-0.6.1-py2.py3-none-any.whl |
Total release size: 17.4 kB
Release files / evc-0.6.1.tar.gz
| Download URL | evc-0.6.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
137b55f740b315a1c82502ce51f54424b53c1248dd1ac48a66feccee1fb0e42d
|
|
BLAKE2b-256 checksum How to use checksums |
bf76d9d975df4390d082d045e15ac058b8d478cc05b409cb3dbdad126ff1523e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.0 CPython/3.7.5
|
Release files / evc-0.6.1-py2.py3-none-any.whl
| Download URL | evc-0.6.1-py2.py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c9663e88d86563051c230eee5a970bdc2f92b66bfe7eabfd7c7e8c346d61835c
|
|
BLAKE2b-256 checksum How to use checksums |
ed13d6ddeee656493b0fa96b005fc14635d48f0468ca808450ef1e9cab8d89fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.0 CPython/3.7.5
|
Security for evc 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.