-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathsearching.py
More file actions
65 lines (55 loc) · 1.77 KB
/
searching.py
File metadata and controls
65 lines (55 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import json
from ..core.rate_limit import rate_limiter
from ..core.validation import (
ORDER_BY_VALUES,
SORT_BY_VALUES,
STAGE_VALUES,
validate_limit,
validate_page,
validate_provider_keys,
validate_response,
validate_value,
)
class ProfileSearching:
"""Manage stage related profile calls."""
def __init__(self, api):
"""Init."""
self.client = api
@rate_limiter
def list(
self,
source_keys=None,
stage=None,
page=1,
limit=30,
sort_by="created_at",
order_by=None,
**kwargs,
):
"""
Retrieve the scoring information.
Args:
source_keys: <list>
source_keys
stage: <string>
stage
limit: <int> (default to 30)
number of fetched profiles/page
page: <int> REQUIRED default to 1
number of the page associated to the pagination
sort_by: <string>
order_by: <string>
Returns
parsing information
"""
query_params = {
"source_keys": json.dumps(validate_provider_keys(source_keys)),
"stage": validate_value(stage, STAGE_VALUES, "stage"),
"limit": validate_limit(limit),
"page": validate_page(page),
"sort_by": validate_value(sort_by, SORT_BY_VALUES, "sort by"),
"order_by": validate_value(order_by, ORDER_BY_VALUES, "oder by"),
}
data = {**query_params, **kwargs}
response = self.client.post("profiles/searching", json=data)
return validate_response(response)