Files
scwrypts/py/redis/interactive.py
T

26 lines
577 B
Python
Raw Normal View History

2022-04-28 16:09:23 -06:00
#!/usr/bin/env python
2023-01-11 17:09:59 -07:00
from argparse import ArgumentParser
2022-04-28 16:09:23 -06:00
2023-01-11 17:09:59 -07:00
from py.lib.redis.client import Client
from py.lib.scwrypts import interactive, getenv
2022-04-28 16:09:23 -06:00
2023-01-11 17:09:59 -07:00
if __name__ != '__main__':
raise Exception('executable only; must run through scwrypts')
parser = ArgumentParser(description = 'establishes a redis client in an interactive python shell')
args = parser.parse_args()
2022-04-28 16:09:23 -06:00
@interactive
def main():
2023-01-11 17:09:59 -07:00
# pylint: disable=possibly-unused-variable
2022-04-28 16:09:23 -06:00
r = Client
2022-06-22 12:17:19 -06:00
print(f'''
>>> r = StrictRedis({getenv("REDIS_HOST")}:{getenv("REDIS_PORT")})
2022-04-28 16:09:23 -06:00
''')
return locals()
2023-01-11 17:09:59 -07:00
main()