def ocrBaiduCloudAnalyze(url): request_url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic" imageId = str(random.randint(0, 9999999)) + ".jpg" r = requests.get(url) imageData = HttpRequests.doGet(url) with open(imageId, 'wb') as f: f.write(r.content) f = open(imageId, 'rb') img = base64.encodebytes(f.read()) os.remove(imageId) params = {"image": img} access_token = ocrBaiduCloudToken() request_url = request_url + "?access_token=" + access_token headers = {'content-type': 'application/x-www-form-urlencoded'} response = requests.post(request_url, data=params, headers=headers) if response: return response.text
def messageFromId(id): url = "http://" + host + "messageFromId?sessionKey=" + getSession( ) + "&id=" + id response = HttpRequests.doGet(url, {'Content-Type': 'application/json'}) response = json.loads(response) return response
def getGroupList(): url = "http://" + host + "groupList?sessionKey=" + getSession() response = HttpRequests.doGet(url, {'Content-Type': 'application/json'}) response = json.loads(response) return response
def getNewsInfo(type): url = DOKTA_OFFICE_SERVER + "news/" + type response = HttpRequests.doGet(url) return response
def getAboutDoInfo(type): url = DOKTA_OFFICE_SERVER + "about/" + type response = HttpRequests.doGet(url) response = json.loads(response) return response['msg']