Skip to content

Commit

Permalink
#16061 retry 429
Browse files Browse the repository at this point in the history
  • Loading branch information
davydov-d committed Sep 28, 2022
1 parent 0d953de commit d3a0ee3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ definitions:
url_base: "https://harvest.greenhouse.io/v1/"
http_method: "GET"
error_handler:
type: DefaultErrorHandler
response_filters:
- http_codes: [ 403 ]
action: IGNORE
type: CompositeErrorHandler
# ignore 403 error but retry default retriable http errors (429, 500 - 600)
error_handlers:
- type: DefaultErrorHandler
response_filters:
- http_codes: [ 403 ]
action: IGNORE
- type: DefaultErrorHandler
authenticator:
type: BasicHttpAuthenticator
username: "{{ config['api_key'] }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,20 @@ def test_parse_response_empty_content(applications_stream):
records = [record for record in parsed_response]

assert records == []


def test_ignore_403(applications_stream):
response = requests.Response()
response.status_code = 403
response._content = b""
parsed_response = applications_stream.retriever.parse_response(response, stream_state={})
records = [record for record in parsed_response]
assert records == []


def test_retry_429(applications_stream):
response = requests.Response()
response.status_code = 429
response._content = b"{}"
should_retry = applications_stream.retriever.should_retry(response)
assert should_retry is True

0 comments on commit d3a0ee3

Please sign in to comment.