# !/usr/bin/env/python # -*- coding:utf-8 -*- from flask import Flask, render_template, request from datetime import timedelta import requests from utils.img2latex import get_ocrlatex_by_url headers = {'Pragma': 'no-cache', 'Cache-Control': 'no-cache', 'X-USER-TOKEN': 'eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMCIsInVzZXJOYW1lIjoiSFgwMDEyMTM4IiwiZXhwIjoxNTY2Mzg3ODA1LCJ1c2VySWQiOiIyMCIsImlhdCI6MTU2NjM3MzQwNX0.9w__2RGncpdMvbiQAmk75ThgPwDaTXF1VyY1xKVs_zFduUEoJ3_6X2q3ZVYsFIpChKeLEWelhwlmMxEP4lU9QA', 'Origin': 'http://xx.cn', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36', 'Accept': '*/*', # 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundarycDnnz7eKalCPv6GJ', 'Referer': '', 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8'} url = "http://192.168.1.140:18085/upload" import json data = {'callback_url': "http://zsytk.dev.xueping.com/wordapi/index/wid/9668", "mydata": json.dumps([{"file_type": "", "file_url": "http://zsytk.dev.xueping.com/data/word/2020/08/5f327c08f3576.doc"}],ensure_ascii=False).encode("utf-8") } # print(requests.Request('POST', url, data=data, json=json).prepare().body.decode( # 'ascii')) # 打印字段名和类型 # r = requests.post(url, data=data, headers=headers) # print(r.text) # # { % # for sub in item[2:5] %} # { % if "src" in sub %} # < img # src = "data:;base64,{{ img_stream }}" > # { % endif %} # { % endfor %} import re pattern_2 = re.compile( r"(([CDE]\s*[..、、]|\([CDE]\)).+?)(?3) # p1 = re.search("(?)'.format(m), sub1, item_str) items_list = eval(item_str) print(items_list)