jpetrucciani / hubspot3

python3.6+ hubspot client based on hapipy, but modified to use the newer endpoints and non-legacy python
MIT License
147 stars 73 forks source link

Exceptions should not expose email address #47

Open WesleyBatista opened 5 years ago

WesleyBatista commented 5 years ago

I think we have room for improvements on the exception handling side.

this is one example of output when a server side error happens:

HubspotServerError

Hubspot Error

---- request ----
POST api.hubapi.com/contacts/v1/contact/createOrUpdate/email/exposed_email@example.com?, [timeout=<class 'int'>]

---- body ----
<class 'NoneType'>

---- headers ----
<class 'dict'>

---- result ----
<class 'int'>

---- body -----
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>cloudflare</center>
</body>
</html>

---- headers -----
<class 'http.client.HTTPMessage'>

---- reason ----
Bad Gateway

---- trigger error ----
<class 'NoneType'>

As a solution on such cases we can catch the exception and try to somehow parse the reason, but would be way more convenient if such thing come from the package.

jpetrucciani commented 5 years ago

Hmm, so if I'm understanding this correctly, you'd want the exception to filter/hide sensitive data (emails, contact IDs, etc.)?

WesleyBatista commented 5 years ago

yes

WesleyBatista commented 5 years ago

I would like to come up with a PR for this, but lacking on time to do it :/

I thought that I should at least create the issue so somebody could pick it up.