testProduct.py 499 B

1234567891011121314151617181920212223
  1. import requests
  2. import json
  3. import numpy as np
  4. def predictProduct():
  5. url = "http://192.168.2.101:15030"
  6. myheaders = {'Content-Type': 'application/json'}
  7. doc_id = "12"
  8. title = ""
  9. content = "123123"
  10. data = {"doc_id":doc_id,"title":title,"content":content}
  11. resp = requests.post(url,json=data,headers=myheaders, verify=True)
  12. print(resp.content.decode("utf8"))
  13. print(json.loads(resp.content.decode("utf8"),"utf8"))
  14. if __name__=="__main__":
  15. predictProduct()