braintree / braintree_python

Braintree Python library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
241 stars 155 forks source link

Headers provided by braintree http util contain mixture of str/bytes #139

Closed jhance closed 1 year ago

jhance commented 2 years ago

In particular the authentication related headers are weirdly explicitly encoded to bytes whereas all the other headers are strings. This is unintuitive when using a custom http strategy and we need to "fix up" the headers to not contain bytes.

hollabaq86 commented 2 years ago

👋 @jhance thanks for reaching out, and apologies for the delay in a reply. To confirm, you're referring to how we're setting authorization in our HTTP class?

We're encoding authentication per the HTTP spec, but it looks like there's a few changes over the different versions of python on libraries that can be used for this, and encodebytes might be a candidate for updating.

I'm not confirming that we'll change this, but I'm going to leave this open for us to keep in mind for updates in future major versions updates.

hollabaq86 commented 1 year ago

I took a deeper look at this and I'm not seeing any changes that we should make in a next major version... I'm wary of letting authorization be custom written in any way out of the box in the SDK. This should remain something that folks who need to do so incorporate that logic themselves. Going to close this as something we won't do.