Commit 7839c6c5 authored by Andreas Ellewsen's avatar Andreas Ellewsen
Browse files

Add example to readme and clean up imports

parent b5dad6ed
# cim-client
Python client for accessing the CIM-API.
\ No newline at end of file
Python client for accessing the CIM-API.
```python
from cim_client import CimClient
from cim_client.models import Person, PersonList
c = CimClient(url='https://example.com',
update_person_url='/_webservices/?ws=contacts/upsert/1.0',
delete_person_url='/_webservices/?ws=contacts/delete/1.0',
tokens={'api_key': {'X-Gravitee-API-Key': 'c-d-a-b'},})
upd_schema = c.get_update_schema()
del_schema = c.get_delete_schema()
person = Person.from_dict({'username': 'foo', 'user_import_id': 'foo1'})
response1 = c.update_person(person)
person2 = Person.from_dict({'username': 'bar', 'user_import_id': 'bar1'})
persons = [person, person2]
personlist = PersonList(persons=persons)
# Note that delete_person supports both PersonList and [Person, Person, ...]
response2 = c.delete_person(personlist)
response3 = c.delete_person(persons)
```
import pytest
import requests_mock
from requests import HTTPError
from requests.adapters import HTTPAdapter
from cim_client.client import CimClient
from cim_client.models import Person, PersonList
from tests.conftest import mock_api
from cim_client.models import Person
@pytest.fixture
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment