Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save selmison/779e054cebdefce8c66415c2e29a1b2c to your computer and use it in GitHub Desktop.
Save selmison/779e054cebdefce8c66415c2e29a1b2c to your computer and use it in GitHub Desktop.
Acessando as licitações do dia
import requests
from bs4 import BeautifulSoup as bs
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# Desabilitando Warnings
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
url = 'http://comprasnet.gov.br/ConsultaLicitacoes/ConsLicitacao_Relacao.asp?numprp=&dt_publ_ini=11/05/2018&dt_publ_fim=11/05/2018&chkModalidade=5&chk_concor=&chk_pregao=1,2,3,4&chk_rdc=&optTpPesqMat=M&optTpPesqServ=S&chkTodos=&chk_concorTodos=&chk_pregaoTodos=-1&txtlstUf=&txtlstMunicipio=&txtlstUasg=&txtlstGrpMaterial=&txtlstClasMaterial=&txtlstMaterial=&txtlstGrpServico=&txtlstServico=&txtObjeto='
# Acessando a URL sem verificar autenticidade do certificado SSL
response = requests.get(url, verify=False)
# Analisando o HTML com o BeautifulSoup usando o html.parser
soup = bs(response.text, 'html.parser')
# Selecionando todos os itens que contem a tag 'form'
forms = soup.find_all('form')
# Navegando em cada item e imprimindo na tela o texto dentro da tag 'b'
for form in forms:
print(form.find('b').getText().strip())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment