File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ class UnprocessableEntity(Exception):
2121 pass
2222
2323
24+ class RateLimitExceeded (Exception ):
25+ pass
26+
27+
2428class BaseService :
2529 """
2630 Base class for services.
@@ -54,6 +58,8 @@ def request(
5458 raise NotFound
5559 elif response .status_code == 422 :
5660 raise UnprocessableEntity (response .text )
61+ elif response .status_code == 429 :
62+ raise RateLimitExceeded (response .text )
5763 if response .status_code == 200 :
5864 return response .json ()
5965 else :
Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ def upload_file_content(
146146 csfunctions.service.Unauthorized: If access check fails.
147147 csfunctions.service.Conflict: If the file is already locked.
148148 csfunctions.service.NotFound: If the file object does not exist.
149+ csfunctions.service.RateLimitExceeded: If the services rate limit is exceeded.
149150 """
150151 persno = persno or self .metadata .app_user
151152 if filesize is None :
@@ -206,6 +207,7 @@ def upload_new_file(
206207 Raises:
207208 csfunctions.service.Unauthorized: If access check fails.
208209 csfunctions.service.NotFound: If the parent object does not exist.
210+ csfunctions.service.RateLimitExceeded: If the services rate limit is exceeded.
209211 """
210212 persno = persno or self .metadata .app_user
211213 file_object_id = self ._create_new_file (
You can’t perform that action at this time.
0 commit comments