Skip to content

Commit db5ede7

Browse files
author
Lev Rubel
committed
mostly updated to 1.10 API version + added more docs and examples
1 parent e2f893c commit db5ede7

File tree

16 files changed

+215
-21
lines changed

16 files changed

+215
-21
lines changed

HISTORY.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
History
22
=================
33

4+
0.1.2 (2019-04-01)
5+
------------------
6+
7+
* API Changelog is now constantly updated here: https://kb.identix.one/#/apichangelog
8+
* Updated documentation to show how to configure client with env variables
9+
* Records endpoints are now deprecated
10+
* Added new Entries and Entries Stats endpoints for RESTful manipulation with data (meant to replace and enhance records functionality)
11+
* Added new Person Entries endpoint: create new person by providing id of NM entry
12+
* Added examples of newly added endpoints
13+
414
0.1.1 (2019-03-16)
515
------------------
616

README.rst

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ identixone-python
1515
A Python package for interacting with the Identix.one API
1616

1717
* Free software: MIT license
18-
* Documentation: https://identixone-python.readthedocs.io/
19-
* Current supported most recent API version: **1.9.1**
20-
* Current stable package version: **0.1.1**
18+
* Package documentation: https://identixone-python.readthedocs.io/
19+
* API documentation: https://kb.identix.one/
20+
* API changelog: https://kb.identix.one/#/apichangelog
21+
* Current supported most recent API version: **1.10.0**
22+
* Current stable package version: **0.1.2**
2123

2224

2325
Installation
@@ -62,11 +64,21 @@ First of all, specify your API token and API version in `Client`:
6264

6365
.. code:: python
6466
65-
from identixone.api import Client
67+
from identixone.api import Client
6668
67-
version = 1
68-
token = 'XXX'
69-
client = Client(token, version)
69+
version = 1
70+
token = 'XXX'
71+
client = Client(token, version)
72+
73+
You can also configure `Client` using environment variables with prefix `IDENTIXONE_` and uppercase key (e.g. TOKEN, VERSION):
74+
75+
.. code:: python
76+
77+
from identixone.api import Client
78+
79+
os.environ['IDENTIXONE_TOKEN'] = 'XXX'
80+
os.environ['IDENTIXONE_VERSION'] = '1'
81+
client = Client(token, version)
7082
7183
Now just make calls using `client` instance as if you were interacting with HTTP API.
7284

@@ -75,9 +87,9 @@ For example, create source:
7587

7688
.. code:: python
7789
78-
response = client.sources.create(name='source_name')
79-
response.json()
80-
# {"id": 1, "name": "source_name", "pps_timestamp": False, ... }
90+
response = client.sources.create(name='source_name')
91+
response.json()
92+
# {"id": 1, "name": "source_name", "pps_timestamp": False, ... }
8193
8294
Or list some records with filters:
8395

examples.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
def list_records():
13+
# DEPRECATED
1314
period_start = datetime.datetime(year=2019, month=1, day=13, hour=19,
1415
minute=20, second=1)
1516
period_end = datetime.datetime(year=2019, month=1, day=22, hour=19,
@@ -90,6 +91,11 @@ def persons_reinit_id():
9091
print(r.json())
9192

9293

94+
def persons_entry():
95+
r = client.persons.entry(id=1)
96+
print(r.json())
97+
98+
9399
def persons_delete():
94100
r = client.persons.delete(idxid='idxid')
95101
print(r.json())
@@ -128,17 +134,51 @@ def bulk_delete_temporary_tokens():
128134

129135

130136
def idxid_records():
137+
# DEPRECATED
131138
idxid = 'idxid'
132139
r = client.records.get(idxid=idxid)
133140
print(r.json())
134141

135142

136143
def entry_delete():
144+
# DEPRECATED
137145
entry_id = 1
138146
r = client.records.entry_delete(entry_id)
139147
print(r.status_code)
140148

141149

150+
def entries():
151+
r = client.entries.list(conf='ha,exact,junk', limit=10, offset=10)
152+
print(r.json())
153+
154+
155+
def entries_detail():
156+
idxid = 'idxid'
157+
date_from = datetime.datetime(year=2019, month=1, day=13, hour=19,
158+
minute=20, second=1)
159+
date_to = datetime.datetime(year=2019, month=1, day=22, hour=19,
160+
minute=20, second=1)
161+
r = client.entries.list(idxid=idxid, date_from=date_from, date_to=date_to)
162+
print(r.json())
163+
164+
165+
def entries_delete():
166+
entry_id = 1
167+
r = client.entries.delete(entry_id)
168+
print(r.status_code)
169+
170+
171+
def stats_idxid():
172+
idxid = 'idxid'
173+
r = client.entries.stats_idxid(idxid=idxid)
174+
print(r.json())
175+
176+
177+
def stats_sources():
178+
r = client.entries.stats_sources()
179+
print(r.json())
180+
181+
142182
def auth_create_token():
143183
r = client.auth.create_token()
144184
print(r.json())

identixone/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__author__ = """Identix One"""
44
__email__ = '[email protected]'
5-
__version__ = '0.1.1'
5+
__version__ = '0.1.2'

identixone/api/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ def auth(self):
7777
cls = self.dynamic_import('identixone.api.auth', 'Auth')
7878
return cls(self.http_client)
7979

80+
@property
81+
def entries(self):
82+
cls = self.dynamic_import('identixone.api.entries', 'Entries')
83+
return cls(self.http_client)
84+
8085
@property
8186
def notifications(self):
8287
cls = self.dynamic_import(

identixone/api/entries/__init__.py

Whitespace-only changes.

identixone/api/entries/v1/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from identixone.api.entries.v1.entries import Entries
2+
3+
__all__ = [Entries]

identixone/api/entries/v1/entries.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Entries(object):
2+
3+
def __init__(self, http_client):
4+
self.http_client = http_client
5+
6+
def list(self, **kwargs):
7+
return self.http_client.get('v1/entries/', params=kwargs)
8+
9+
def delete(self, id):
10+
return self.http_client.delete('v1/entries/{}/'.format(id))
11+
12+
def stats_idxid(self, idxid):
13+
return self.http_client.get('v1/entries/stats/idxid/{}/'.format(idxid))
14+
15+
def stats_sources(self, **kwargs):
16+
return self.http_client.get('v1/entries/stats/sources/', params=kwargs)

identixone/api/notifications/v1/notifications.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ class Notifications(object):
33
def __init__(self, http_client):
44
self.http_client = http_client
55

6-
def list(self):
7-
return self.http_client.get('v1/settings/notifications/')
6+
def list(self, **kwargs):
7+
return self.http_client.get(
8+
'v1/settings/notifications/', params=kwargs)
89

910
def create(self, name, is_active, transport, destination_url=None,
1011
conf_thresholds=None, age_from=None, age_to=None, sex=None,

identixone/api/persons/v1/persons.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ def create(self, photo, source, facesize=None, create_on_ha=False,
2121
files = {'photo': photo}
2222
return self.http_client.post('v1/persons/', data=data, files=files)
2323

24+
def entry(self, id, facesize=None, create_on_ha=False,
25+
create_on_junk=False):
26+
data = {
27+
'id': id,
28+
'facesize': facesize,
29+
'create_on_ha': create_on_ha,
30+
'create_on_junk': create_on_junk
31+
}
32+
return self.http_client.post('v1/persons/entry/', data=data)
33+
2434
def search(self, photo, asm=False, liveness=False):
2535
data = {'asm': asm, 'liveness': liveness}
2636
files = {'photo': photo}

0 commit comments

Comments
 (0)