testRedisClient.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*- coding: utf-8 -*-
  2. """
  3. -------------------------------------------------
  4. File Name: testRedisClient
  5. Description :
  6. Author : JHao
  7. date: 2020/6/23
  8. -------------------------------------------------
  9. Change Activity:
  10. 2020/6/23:
  11. -------------------------------------------------
  12. """
  13. __author__ = 'JHao'
  14. def main():
  15. from db.DbClient import DbClient
  16. from helper.proxy import Proxy
  17. db = DbClient("redis://:_@Fintell@10.10.61.65:6379")
  18. db.changeTable("raw_proxy")
  19. proxy = Proxy.newProxyFromJson(
  20. '{"proxy": "27.38.96.101:9797", "fail_count": 0, "region": "", "type": "",'
  21. ' "source": "freeProxy03", "check_count": 0, "last_status": "", "last_time": ""}')
  22. print("put: ", db.put(proxy))
  23. print("get: ", db.get())
  24. print("exists: ", db.exists("27.38.96.101:9797"))
  25. print("exists: ", db.exists("27.38.96.101:8888"))
  26. print("pop: ", db.pop())
  27. print("getAll: ", db.getAll())
  28. print("getCount", db.getCount())
  29. if __name__ == '__main__':
  30. main()