Commit 0be8ae9b authored by DarkRedman's avatar DarkRedman Committed by GitHub
Browse files

Fix cache

Fixing the cache key for both get and store methods
parent cd46550b
......@@ -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:, result)'%s?%s' % (url, urlencode(self.session.params)), result)
return result
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment