# 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
```
Release files for python-cip 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-cip-0.0.4.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_cip-0.0.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / python-cip-0.0.4.tar.gz
| Download URL | python-cip-0.0.4.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
971628e213656e6f932c1bf401824f80f03ce90e2e93b254e228076458fea49c
|
|
BLAKE2b-256 checksum How to use checksums |
8496100235fecef38240db1951eeae3e3ad2f89b42d4a128a6cce921d835348a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / python_cip-0.0.4-py2.py3-none-any.whl
| Download URL | python_cip-0.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
25ac09f458bf1acfe545d842e36c36365510feb75fb03153dcb6972fec59ccd4
|
|
BLAKE2b-256 checksum How to use checksums |
ecaa5c9ff6feec8ce2e8dd9d732e299a25d8c166ab1c8dc10772e9aa47c1ab7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |