Skip to content

Commit 4462a32

Browse files
feat: add rate limit to all endpoint
1 parent 9df862a commit 4462a32

25 files changed

Lines changed: 63 additions & 11 deletions

hrflow/auth/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import typing as t
22

33
from ..core.validation import validate_key, validate_response
4+
from ..core.rate_limit import rate_limiter
45

56
API_SECRET_REGEX = r"^ask[rw]?_[0-9a-f]{32}$"
67

@@ -9,6 +10,7 @@ class Auth:
910
def __init__(self, api):
1011
self.client = api
1112

13+
@rate_limiter
1214
def get(self) -> t.Dict[str, t.Any]:
1315
"""
1416
Try your API Keys. This endpoint allows you to learn how to add the right

hrflow/board/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
validate_response,
77
validate_value,
88
)
9+
from ..core.rate_limit import rate_limiter
910

1011

1112
class Board(object):
1213
def __init__(self, client):
1314
self.client = client
1415

16+
@rate_limiter
1517
def list(self, name=None, page=1, limit=30, sort_by="date", order_by="desc"):
1618
"""
1719
Search boards for given filters.
@@ -42,6 +44,7 @@ def list(self, name=None, page=1, limit=30, sort_by="date", order_by="desc"):
4244
response = self.client.get("boards", query_params)
4345
return validate_response(response)
4446

47+
@rate_limiter
4548
def get(self, key=None):
4649
"""
4750
Get source given a board key.

hrflow/job/asking.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
validate_reference,
77
validate_response,
88
)
9+
from ..core.rate_limit import rate_limiter
910

1011

1112
class JobAsking:
1213
def __init__(self, api):
1314
self.client = api
1415

16+
@rate_limiter
1517
def get(
1618
self,
1719
board_key: str,

hrflow/job/embedding.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from ..core.validation import validate_response
22
from ..core import format_item_payload
3-
3+
from ..core.rate_limit import rate_limiter
44

55
class JobEmbedding:
66
"""Manage embedding related job calls."""
@@ -9,6 +9,7 @@ def __init__(self, api):
99
"""Init."""
1010
self.client = api
1111

12+
@rate_limiter
1213
def get(self, board_key, key=None, reference=None):
1314
"""
1415
Retrieve the parsing information.

hrflow/job/scoring.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
validate_response,
1212
validate_value,
1313
)
14+
from ..core.rate_limit import rate_limiter
1415

1516

1617
class JobScoring:
@@ -20,6 +21,7 @@ def __init__(self, api):
2021
"""Init."""
2122
self.client = api
2223

24+
@rate_limiter
2325
def list(
2426
self,
2527
board_keys=None,

hrflow/job/searching.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
validate_response,
1111
validate_value,
1212
)
13+
from ..core.rate_limit import rate_limiter
1314

1415

1516
class JobSearching:
@@ -19,6 +20,7 @@ def __init__(self, api):
1920
"""Init."""
2021
self.client = api
2122

23+
@rate_limiter
2224
def list(
2325
self,
2426
board_keys=None,

hrflow/job/storing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
validate_value,
1414
)
1515
from ..core import format_item_payload
16+
from ..core.rate_limit import rate_limiter
1617

1718

1819
class JobStoring:
@@ -28,6 +29,7 @@ def __init__(self, api):
2829
"""
2930
self.client = api
3031

32+
@rate_limiter
3133
def add_json(self, board_key, job_json):
3234
"""This endpoint allows you to Index a Job object.
3335
Note: If your Job is an unstructured text, make sure to parse it first before
@@ -120,6 +122,7 @@ def add_json(self, board_key, job_json):
120122
response = self.client.post("job/indexing", json=job_json)
121123
return validate_response(response)
122124

125+
@rate_limiter
123126
def edit(self, board_key, job_json, key=None):
124127
"""
125128
Edit a job already stored in the given source.
@@ -148,6 +151,7 @@ def edit(self, board_key, job_json, key=None):
148151
response = self.client.put("job/indexing", json=job_json)
149152
return validate_response(response)
150153

154+
@rate_limiter
151155
def get(self, board_key, key=None, reference=None):
152156
"""
153157
Retrieve the parsing information.
@@ -168,6 +172,7 @@ def get(self, board_key, key=None, reference=None):
168172
response = self.client.get("job/indexing", query_params)
169173
return validate_response(response)
170174

175+
@rate_limiter
171176
def archive(self, board_key, key=None, reference=None):
172177
"""
173178
This method allows to archive (is_archive=1) or unarchive (is_archive=0) a job
@@ -192,6 +197,7 @@ def archive(self, board_key, key=None, reference=None):
192197
response = self.client.patch("job/indexing/archive", json=payload)
193198
return validate_response(response)
194199

200+
@rate_limiter
195201
def list(
196202
self,
197203
board_keys,

hrflow/profile/asking.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
validate_reference,
77
validate_response,
88
)
9-
9+
from ..core.rate_limit import rate_limiter
1010

1111
class ProfileAsking:
1212
def __init__(self, api):
1313
self.client = api
1414

15+
@rate_limiter
1516
def get(
1617
self,
1718
source_key: str,

hrflow/profile/attachment.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from ..core.validation import validate_response
22
from ..core import format_item_payload
33

4+
from ..core.rate_limit import rate_limiter
45

56
class ProfileAttachments:
67
"""Manage documents related profile calls."""
@@ -9,6 +10,7 @@ def __init__(self, api):
910
"""Init."""
1011
self.client = api
1112

13+
@rate_limiter
1214
def list(self, source_key, key=None, reference=None, email=None):
1315
"""
1416
Retrieve the interpretability information.

hrflow/profile/embedding.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ..core.validation import validate_response
44
from ..core import format_item_payload
55

6+
from ..core.rate_limit import rate_limiter
67

78
class ProfileEmbedding:
89
"""Manage embedding related profile calls."""
@@ -11,6 +12,7 @@ def __init__(self, api):
1112
"""Init."""
1213
self.client = api
1314

15+
@rate_limiter
1416
def get(self, source_key, key=None, reference=None, email=None, fields={}):
1517
"""
1618
Retrieve the interpretability information.

0 commit comments

Comments
 (0)