ttshitu.py 698 B

12345678910111213141516171819202122
  1. import base64
  2. import json
  3. import requests
  4. def base64_api(uname, pwd, img):
  5. with open(img, 'rb') as f:
  6. base64_data = base64.b64encode(f.read())
  7. b64 = base64_data.decode()
  8. data = {"username": uname, "password": pwd, "typeid": 27, "image": b64}
  9. result = json.loads(requests.post("http://api.ttshitu.com/imageXYPlus", json=data).text)
  10. print(result)
  11. if result['success']:
  12. return result["data"]["result"], result["data"]["id"]
  13. else:
  14. return result["message"], result["success"]
  15. def error_report(rid):
  16. d = {"id": rid}
  17. result = json.loads(requests.post("http://api.ttshitu.com/reporterror.json", json=d).text)
  18. return result["success"]