From: DarkRedman Date: Sun, 21 Aug 2016 10:35:06 +0000 (+0200) Subject: Fix cache X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0be8ae9ba36ec9a7a5e84d8e267181a4f87ed375;p=tweepy.git Fix cache Fixing the cache key for both get and store methods --- diff --git a/tweepy/binder.py b/tweepy/binder.py index b96e4d3..018b22c 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -7,7 +7,7 @@ from __future__ import print_function import time import re -from six.moves.urllib.parse import quote +from six.moves.urllib.parse import quote, urlencode import requests import logging @@ -132,7 +132,7 @@ def bind_api(**config): # Query the cache if one is available # and this request uses a GET method. if self.use_cache and self.api.cache and self.method == 'GET': - cache_result = self.api.cache.get(url) + cache_result = self.api.cache.get('%s?%s' % (url, urllib.urlencode(self.session.params))) # if cache result found and not expired, return it if cache_result: # must restore api reference @@ -233,7 +233,7 @@ def bind_api(**config): # Store result into cache if one is available. if self.use_cache and self.api.cache and self.method == 'GET' and result: - self.api.cache.store(url, result) + self.api.cache.store('%s?%s' % (url, urlencode(self.session.params)), result) return result