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

Prevent duplicated querystring parameters when getting batches of contacts #52

Closed sangaline closed 5 years ago

sangaline commented 5 years ago

The ContactsClient.get_batch() method was mutating the ContactsClient.default_batch_properties when adding in the extra_properties. This resulted in a situation where subsequent calls to ContactsClient.get_batch() would cause property=X to be repeated once for each time it had been included previously. This eventually leads to a bad request error from Hubspot once the URI gets too long.

This PR stops the ContactsClient.default_batch_properties mutation from happening, and uses a set instead of a list so that there won't be duplicate properties in the query string even if they appear in both extra_properties and ContactsClient.default_batch_properties.

jpetrucciani commented 5 years ago

Another good catch! I'll get this merged and released soon.

jpetrucciani commented 5 years ago

This is now live on pip as version 3.2.23!

Thanks again for this fix! 😄