Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HGI-6458 - Added curl generator in case of 400s and 500s #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ python = "<3.11,>=3.7.1"
requests = "^2.25.1"
singer-sdk = "^0.4.4"
"backports.cached-property" = "^1.0.1"
curlify = "^2.2.1"

[tool.poetry.dev-dependencies]
pytest = "^6.2.5"
Expand Down
5 changes: 5 additions & 0 deletions tap_hubspot_beta/client_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""REST client handling, including hubspotStream base class."""
import copy
import logging
import curlify

import requests
import backoff
Expand Down Expand Up @@ -146,13 +147,17 @@ def validate_response(self, response: requests.Response) -> None:
f"{response.status_code} Server Error: "
f"{response.reason} for path: {self.path}"
)
curl_command = curlify.to_curl(response.request)
logging.error(f"CURL command for failed request: {curl_command}")
raise RetriableAPIError(msg)

elif 400 <= response.status_code < 500:
msg = (
f"{response.status_code} Client Error: "
f"{response.reason} for path: {self.path}"
)
curl_command = curlify.to_curl(response.request)
logging.error(f"CURL command for failed request: {curl_command}")
raise FatalAPIError(msg)

@staticmethod
Expand Down