Skip to content

Instantly share code, notes, and snippets.

@duarteguilherme
Created March 19, 2018 21:17
Show Gist options
  • Save duarteguilherme/704251e28e725fcae5d3b636c76e923d to your computer and use it in GitHub Desktop.
Save duarteguilherme/704251e28e725fcae5d3b636c76e923d to your computer and use it in GitHub Desktop.
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