Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
0be8ae9b
Commit
0be8ae9b
authored
Aug 21, 2016
by
DarkRedman
Committed by
GitHub
Aug 21, 2016
Browse files
Fix cache
Fixing the cache key for both get and store methods
parent
cd46550b
Changes
1
Show whitespace changes
Inline
Side-by-side
tweepy/binder.py
View file @
0be8ae9b
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment