Skip to content

Error when max-age is set #268

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

Closed
recursiveMake opened this issue Nov 22, 2021 · 1 comment · Fixed by #269
Closed

Error when max-age is set #268

recursiveMake opened this issue Nov 22, 2021 · 1 comment · Fixed by #269

Comments

@recursiveMake
Copy link

When using the redis cachecontrol, I get an error when the max-age header is set.

expires = 900

    def set(self, key, value, expires=None):
        if not expires:
            self.conn.set(key, value)
        else:
>           expires = expires - datetime.utcnow()
E           TypeError: unsupported operand type(s) for -: 'int' and 'datetime.datetime'

pyenv/lib/python3.6/site-packages/cachecontrol/caches/redis_cache.py:23: TypeError

I believe this is because we set expires_time to an int here instead of a datetime.

@davegaeddert
Copy link
Contributor

@recursiveMake I ran into the same issue. #269 is one potential solution...

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 a pull request may close this issue.

2 participants