-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call tool can now load a remote Google spreadsheet which overrides de…
…fault campaign behaviors on a per-state basis. Using this, you can change the order of the house rep senator calls, always call an individual politician first, or add a special name and number to call before any of the politicians. Also we are now able to randomize the campaign phone call order.
- Loading branch information
1 parent
706441b
commit 8719ece
Showing
8 changed files
with
1,062 additions
and
856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ venv | |
*.pyc | ||
*.db | ||
.env | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from redis import Redis | ||
|
||
class CacheHandler(): | ||
|
||
redis_conn = None | ||
|
||
def __init__(self, redis_url): | ||
|
||
if redis_url: | ||
self.redis_conn = Redis.from_url(redis_url) | ||
|
||
def get(self, key, default): | ||
|
||
if self.redis_conn == None: | ||
return default | ||
|
||
return self.redis_conn.get(key) or default | ||
|
||
def set(self, key, val, expire=None): | ||
|
||
if self.redis_conn == None: | ||
return | ||
|
||
if expire == None: | ||
self.redis_conn.set(key, val) | ||
else: | ||
self.redis_conn.setex(key, val, expire) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.