123456789101112131415161718192021222324252627282930 |
- # -*- coding: utf-8 -*-
- # @Time : 2021/6/17 10:36
- # @Author : XuJiakai
- # @File : WinhcHbaseApi
- # @Software: PyCharm
- import requests as r
- import json
- class WinhcHbaseApi:
- def __init__(self, host):
- self.host = "http://" + host+":8288"
- pass
- def bulk_get_human(self, rs):
- res = r.post(self.host + "/hbase/bulk-get/human", json=rs)
- res = json.loads(res.text)
- return res
- def get_record(self, table_name, rowkey):
- res = r.get(self.host + "/hbase/get/%s/%s" % (table_name, rowkey))
- return json.loads(res.text)['data']
- def scan(self, table_name, prefix, size):
- res = r.get(self.host + "/hbase/scan/%s/%s_?size=%s" % (table_name, prefix, size))
- return json.loads(res.text)['data']
- if __name__ == '__main__':
- pass
|