# ims-python-api-connector
Connector for the FTP Technologies IMS HTTP API
## How to install
`$ pip install ims-api-connector`
## How to use
There are `.connect()` and `.close()` methods exposed as well as a context manager API (`__enter__()` and `__exit__()`) but you don't have to use either- simply calling `.get()`, `.post()` etc will handle the authentication for you.
Additionally, it will retry authentication if it picks up an authentication error during a request (to handle expired tokens etc) but if the attempt to re-authenticate fails, it will stop retrying.
```
from ims_api_connector import IMSAPIConnector
connector = IMSAPIConnector(
url='https://some.ims.instance.com/api/',
username='some_username',
password='some_password',
timeout=5, # optional; seconds until a request times out
retries=6, # optional; number of re-auth attempts during a request
backoff=5, # optional; seconds between re-auth attempts
insecure=False, # optional; ignore certificate warnings
logger=None, # optional; Python logger object
)
connector.get('assets/?limit=50000')
```
Which returns an object like this:
```
Response(
status_code=200,
text='{"some": "data"}',
json={'some': 'data'},
error=None, # any JSON parse exception object
traceback=None, # traceback string for JSON parse exception
)
```
## How to develop
Prerequisites:
* pip
* virtualenvwrapper
* entr
Instructions:
* Create a virtualenv
* `mkvirtualenv ims-python-api-connector`
* Install the requirements
* `pip install -r requirements.txt`
* Watch the tests
* ./watch_tests.sh
* Write some code
Connector for the FTP Technologies IMS HTTP API
## How to install
`$ pip install ims-api-connector`
## How to use
There are `.connect()` and `.close()` methods exposed as well as a context manager API (`__enter__()` and `__exit__()`) but you don't have to use either- simply calling `.get()`, `.post()` etc will handle the authentication for you.
Additionally, it will retry authentication if it picks up an authentication error during a request (to handle expired tokens etc) but if the attempt to re-authenticate fails, it will stop retrying.
```
from ims_api_connector import IMSAPIConnector
connector = IMSAPIConnector(
url='https://some.ims.instance.com/api/',
username='some_username',
password='some_password',
timeout=5, # optional; seconds until a request times out
retries=6, # optional; number of re-auth attempts during a request
backoff=5, # optional; seconds between re-auth attempts
insecure=False, # optional; ignore certificate warnings
logger=None, # optional; Python logger object
)
connector.get('assets/?limit=50000')
```
Which returns an object like this:
```
Response(
status_code=200,
text='{"some": "data"}',
json={'some': 'data'},
error=None, # any JSON parse exception object
traceback=None, # traceback string for JSON parse exception
)
```
## How to develop
Prerequisites:
* pip
* virtualenvwrapper
* entr
Instructions:
* Create a virtualenv
* `mkvirtualenv ims-python-api-connector`
* Install the requirements
* `pip install -r requirements.txt`
* Watch the tests
* ./watch_tests.sh
* Write some code
Metadata
Release files for ims-api-connector 2018.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ims-api-connector-2018.2.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ims_api_connector-2018.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.5 kB
Release files / ims-api-connector-2018.2.tar.gz
| Download URL | ims-api-connector-2018.2.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd91f2535fd6d6b0bedc0e7b0888b96a2b4888a1c182ea88ce900f158ff6c16f
|
|
BLAKE2b-256 checksum How to use checksums |
5568c21f2fb0758e5724e0235a33003d6c1ee8ee695f5c6da98adc24e36fcead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ims_api_connector-2018.2-py3-none-any.whl
| Download URL | ims_api_connector-2018.2-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be9980854a74c6bd932d6f25d7987f6993f52b106ba13dd1c2b2fabfe5ace685
|
|
BLAKE2b-256 checksum How to use checksums |
11926e4f641ef10994247c6c3df6487e7d9acf75337364723cbb1f390f2d1e73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |