Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow datetime.timedelta for leeway arg #56

Merged
merged 4 commits into from
Jan 5, 2015
Merged

allow datetime.timedelta for leeway arg #56

merged 4 commits into from
Jan 5, 2015

Conversation

wbolster
Copy link
Contributor

@wbolster wbolster commented Jan 2, 2015

This fixes #54.

@wbolster
Copy link
Contributor Author

wbolster commented Jan 2, 2015

Btw, the tests directly call into verify_signature(), while this doesn't seem to be part of the public API (not in __all__). Is this intentional?

@wbolster
Copy link
Contributor Author

wbolster commented Jan 2, 2015

Sigh, Python 2.6 doesn't have datetime.timedelta.total_seconds(). I'll add a compatibility hack.

@jpadilla
Copy link
Owner

jpadilla commented Jan 2, 2015

@wbolster LGTM. Let's also update the README to document this behavior.

@wbolster
Copy link
Contributor Author

wbolster commented Jan 2, 2015

ok will update the readme with examples

"José Padilla" notifications@github.com schreef op 2 januari 2015 19:59:36 CET:

@wbolster LGTM. Let's also update the README to document this behavior.


Reply to this email directly or view it on GitHub:
#56 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

import hashlib
import hmac
import sys

from datetime import datetime
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be cleaner if we kept this line and added timedelta

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically, it doesn't make sense to add datetime. in 10+ places when we can just add timedelta to this import.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, will change. I just have a personal distaste for non-module imports. ;)

@wbolster
Copy link
Contributor Author

wbolster commented Jan 5, 2015

I've pushed an updated version. The imports are simpler now, and I've updated the README. The exception approach for Python 2.6 compatibility due to missing timedelta.total_seconds() is left as-is; see the comments on the previous iteration for details.

@mark-adams
Copy link
Contributor

Looks good to me

jpadilla added a commit that referenced this pull request Jan 5, 2015
Allow datetime.timedelta for leeway arg
@jpadilla jpadilla merged commit ab7fb28 into jpadilla:master Jan 5, 2015
@wbolster wbolster deleted the issue-54 branch January 6, 2015 12:40
@jpadilla
Copy link
Owner

jpadilla commented Jan 7, 2015

@wbolster thinking about dropping the checks for total_seconds and always using:

leeway = leeway.days * 24 * 60 * 60 + leeway.seconds

@wbolster
Copy link
Contributor Author

wbolster commented Jan 7, 2015

Sure, would be fine with a comment explaining why. But think about those poor microseconds! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow datetime.timedelta instance for leeway argument
4 participants