Created
March 19, 2018 21:17
-
-
Save duarteguilherme/704251e28e725fcae5d3b636c76e923d to your computer and use it in GitHub Desktop.
This file contains 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
from PIL import Image, ImageFilter | |
import os | |
import requests | |
import numpy as np | |
import hashlib | |
import pickle | |
def classifica_arquivo(): | |
url = 'http://www.cmc.pr.gov.br/wspl/jcaptcha.jpg' | |
content = requests.get(url) | |
open('arquivo.jpg','wb').write(content.content) | |
imagem_arquivo = Image.open('arquivo.jpg') | |
dados_arquivo = np.array(imagem_arquivo) | |
nome_arquivo_novo = hashlib.md5(dados_arquivo).hexdigest() | |
imagem_arquivo.show() | |
resposta = input("Digite o captcha:") | |
dados = {'resposta': resposta} | |
dados['dados_arquivo'] = dados_arquivo | |
arquivo_salvar = open(nome_arquivo_novo + '.p', 'wb') | |
pickle.dump(dados, file = arquivo_salvar) | |
classifica_arquivo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment