Very simple python interface to Canto Cumulus CIP
Project description
# python-cip
A very simple python interface to Canto Cumulus CIP
Wraps [requests](http://python-requests.org) to call CIP endpoints in a session
## API
### class cip.CIP
> CIP(url, serveraddress, user=None, password=None)
#### Methods:
** login(user = None, password=None, catalogname=None) **
Open a session on CIP. Returns reply from server.
** do(api, rawdata=False, ...) **
Call a `api` CIP endpoint. Returns reply from server.
If `rawdata` is False, reply is parsed JSON.
Any extra arguments are passed to request post call
** request(api, ...) **
Do a POST request to `api` CIP endpoint. Returns
[request Response object](http://docs.python-requests.org/en/master/api/#requests.Response)
Any extra arguments are passed to request post call
** logout(self) **
Close CIP session. Returns nothing
### class cip.CIPException(Exception)
## Example
```python
from cip import CIP
self.cip = CIP("http://localhost:8080/CIP/", "localhost")
self.cip.login('user', 'password', 'Sample Catalog')
r = self.cip.do("metadata/search/Sample Catalog", data={
'querystring': '"Asset Name" contains "photo"',
'field': ["ID", "Asset Name", "Asset Modification Date"],
})
print( r['items'][0]['Asset Modification Date'] )
```
## Test
```bash
$ pip install tox
$ tox
```
A very simple python interface to Canto Cumulus CIP
Wraps [requests](http://python-requests.org) to call CIP endpoints in a session
## API
### class cip.CIP
> CIP(url, serveraddress, user=None, password=None)
#### Methods:
** login(user = None, password=None, catalogname=None) **
Open a session on CIP. Returns reply from server.
** do(api, rawdata=False, ...) **
Call a `api` CIP endpoint. Returns reply from server.
If `rawdata` is False, reply is parsed JSON.
Any extra arguments are passed to request post call
** request(api, ...) **
Do a POST request to `api` CIP endpoint. Returns
[request Response object](http://docs.python-requests.org/en/master/api/#requests.Response)
Any extra arguments are passed to request post call
** logout(self) **
Close CIP session. Returns nothing
### class cip.CIPException(Exception)
## Example
```python
from cip import CIP
self.cip = CIP("http://localhost:8080/CIP/", "localhost")
self.cip.login('user', 'password', 'Sample Catalog')
r = self.cip.do("metadata/search/Sample Catalog", data={
'querystring': '"Asset Name" contains "photo"',
'field': ["ID", "Asset Name", "Asset Modification Date"],
})
print( r['items'][0]['Asset Modification Date'] )
```
## Test
```bash
$ pip install tox
$ tox
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-cip-0.0.4.tar.gz
(5.4 kB
view details)
Built Distribution
File details
Details for the file python-cip-0.0.4.tar.gz
.
File metadata
- Download URL: python-cip-0.0.4.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 971628e213656e6f932c1bf401824f80f03ce90e2e93b254e228076458fea49c |
|
MD5 | a56802e0d24439811672f69077815c7c |
|
BLAKE2b-256 | 8496100235fecef38240db1951eeae3e3ad2f89b42d4a128a6cce921d835348a |
File details
Details for the file python_cip-0.0.4-py2.py3-none-any.whl
.
File metadata
- Download URL: python_cip-0.0.4-py2.py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25ac09f458bf1acfe545d842e36c36365510feb75fb03153dcb6972fec59ccd4 |
|
MD5 | 2569e97cbe9696afbed0d72c80bfcc49 |
|
BLAKE2b-256 | ecaa5c9ff6feec8ce2e8dd9d732e299a25d8c166ab1c8dc10772e9aa47c1ab7a |