csingley / ofxtools

Python OFX Library
Other
301 stars 68 forks source link

Make User-Agent header configurable #100

Closed aclindsa closed 3 years ago

aclindsa commented 3 years ago

I've come across an FI which dislikes the HTTP User-Agent header being empty (coincidentally the same that doesn't like NEWFILEUID), but others have found FIs which dislike it containing different values... so is it time to parameterize it? This PR leaves the default behavior unchanged, but adds a parameter to OFXClient and a matching argument to ofxget to support overriding the user agent

This commit allows me to successfully make requests to this FI with ofxtools.

Question: Given our previous discussion about how to organize the arguments in ofxget - where would you like this one? I'm not sure I would think of an HTTP header as a 'formatting' argument, but I think it likely applies to the same set of subcommands...

csingley commented 3 years ago

so is it time to parameterize it?

If it's useful, why not? Incidentally, what value of User-Agent is acceptable to your FI?

Given our previous discussion about how to organize the arguments in ofxget - where would you like this one?

For the time being it looks fine to me where it is, right next to the other transport-layer option (skip SSL cert verification). More importantly, the implementation in OFXClient looks right (i.e. set as an instance variable by __init__())

This all seems fine & well. At some point some unit tests exercising the new functionality ought to go in though...