WinhcHbaseApi.py 802 B

123456789101112131415161718192021222324252627282930
  1. # -*- coding: utf-8 -*-
  2. # @Time : 2021/6/17 10:36
  3. # @Author : XuJiakai
  4. # @File : WinhcHbaseApi
  5. # @Software: PyCharm
  6. import requests as r
  7. import json
  8. class WinhcHbaseApi:
  9. def __init__(self, host):
  10. self.host = "http://" + host+":8288"
  11. pass
  12. def bulk_get_human(self, rs):
  13. res = r.post(self.host + "/hbase/bulk-get/human", json=rs)
  14. res = json.loads(res.text)
  15. return res
  16. def get_record(self, table_name, rowkey):
  17. res = r.get(self.host + "/hbase/get/%s/%s" % (table_name, rowkey))
  18. return json.loads(res.text)['data']
  19. def scan(self, table_name, prefix, size):
  20. res = r.get(self.host + "/hbase/scan/%s/%s_?size=%s" % (table_name, prefix, size))
  21. return json.loads(res.text)['data']
  22. if __name__ == '__main__':
  23. pass