From 0be8ae9ba36ec9a7a5e84d8e267181a4f87ed375 Mon Sep 17 00:00:00 2001 From: DarkRedman Date: Sun, 21 Aug 2016 12:35:06 +0200 Subject: [PATCH] Fix cache Fixing the cache key for both get and store methods --- tweepy/binder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.25.1