Kami / python-yubico-client

Python library for validating Yubico Yubikey One Time Passwords (OTPs) based on the validation protocol version 2.0.
https://yubico-client.readthedocs.org/en/latest/
Other
82 stars 19 forks source link

Added parameter to Yubico for specifying custom validation URLs. #18

Closed dainnilsson closed 11 years ago

dainnilsson commented 11 years ago

I noticed that the only way to specify validation server URLs was a rather ugly way of overwriting the constant where they are stored. This pull request adds an optional parameter, api_urls, which can be passed to Yubico to set the API URLs used by that instance.

Kami commented 11 years ago

It would also be nice to add a test case for this functionality.

Besides this and a couple of other minor things I have mentioned, the change looks good to me. Thanks.

dainnilsson commented 11 years ago

Initially I was weary of adding any changes that may break backwards-compatibility, but since you're ok with the the change in general I'll look over the comments and send an updated pull request in response to your comments!

dainnilsson commented 11 years ago

There, I've added a check to ensure that the URLs are a list or tuple. I also added support for a string in case there is only a single server. It seemed to make more sense to only generate the URL list once now, so I've replaced generate_request_urls with _init_request_urls, which is run during construction, and the use_https flag is discarded afterwards. I've also added a TestCase for the new behavior.

Kami commented 11 years ago

Thanks :)

I've fixed the pep8 issue and merged your pull request into master. I will publish new version with this change to PyPi soon.