Created
November 19, 2019 09:13
-
-
Save cokia/390729b4fa1b4fa2feb04bfcabcdf5a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
from flask import Flask, request | |
import os | |
import base64 | |
import urllib.parse | |
import json | |
import subprocess | |
app = Flask(__name__) | |
@app.route("/captcha", methods=["GET"]) | |
def captcha1(): | |
base164 = request.args.get('image') #title | |
data = urllib.parse.unquote(base164) | |
#data = json.loads(base64) | |
png_recovered = base64.b64decode(data) | |
x = subprocess.check_output(['tesseract temp.png a.txt -c tessedit_char_whitelist=0123456789']) | |
f = open("a.txt", "r") | |
fi = f.read() | |
f.close() | |
print(fi) | |
return str(fi) | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', port=5000, debug=False) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment