Consulta de CPF e CNPJ na Receita Federal com Web-Scraping

Overview

Consulta de CPF e CNPJ na Receita Federal com Web-Scraping

Repositório contendo scripts Python que realizam a consulta de CPF e CNPJ diretamente no site da Receita Federal.

Requerimentos

  • Python 3.x instalado;
  • Driver do navegador que será utilizado. Clique aqui para mais informações;
  • Caminho do driver baixado adicionado ao PATH.

Instalação

Na pasta do repositório, execute o comando:

pip install -r requirements.txt

Alterações necessárias

Para a execução, é necessário adaptar o código para o navegador que será utilizado. Por padrão o código utiliza o navegador Microsoft Edge. Modificar se necessário:

  • Importações dos módulos. Mudar edge para o navegador que será usado:
from selenium.webdriver.edge.service import Service
from selenium.webdriver.edge.options import Options
  • Caminho do driver baixado:
PATH_TO_DRIVER = "C:/edge_driver/msedgedriver.exe"
  • Inicialização do webdriver. Mudar Edge para o navegador que será usado:
driver = webdriver.Edge(service=serv, service_log_path="NUL", options=options)

Consulta de CNPJ - Exemplo

Na pasta do repositório, execute o comando:

python cnpj/consulta_cnpj.py

Digite os campos necessários:

Digite o CNPJ (somente números): 06990590000395
Digite os caracteres da imagem exibida: ZaQO5z

Com os dados inseridos corretamente, a consulta exibirá um JSON de retorno:

{
    "cnpj": "06.990.590/0003-95",
    "tipo_empresa": "FILIAL",
    "data_abertura": "11/01/2008",
    "nome_empresarial": "GOOGLE BRASIL INTERNET LTDA.",
    "nome_fantasia": "********",
    "endereco": {
        "logradouro": "AV DOS ANDRADAS",
        "numero": "3000",
        "complemento": "ANDAR 5 14 15 16 17 EDIF BOULEVARD CORPORATE",
        "cep": "30.260-070",
        "bairro": "SANTA EFIGENIA",
        "municipio": "BELO HORIZONTE",
        "estado": "MG"
    },
    "email": "[email protected]",
    "telefone": "(11) 2395-8400",
    "situacao_cadastral": "ATIVA",
    "data_situacao_cadastral": "11/01/2008"
}

Consulta de CPF - Exemplo

Na pasta do repositório, execute o comando:

python cpf/consulta_cpf.py

Digite os campos necessários:

Digite o CPF (somente números): 12345678901
Digite a data de nascimento (DD/MM/AAAA): 25/12/2000
Digite os caracteres da imagem exibida: 9XETCm

Com os dados inseridos corretamente, a consulta exibirá um JSON de retorno:

{
    "cpf": "123.456.789-01",
    "nome": "FULANO BELTRANO CICLANO",
    "data_nascimento": "25/12/2000",
    "situacao_cadastral": "REGULAR",
    "data_inscricao": "12/04/2006",
    "digito_verificador": "00"
}
Owner
Josué Campos
I am a student of computer science at @ufv. Computer mathematics, AI, data science and IoT enthusiastic.
Josué Campos
A tool for scraping and organizing data from NewsBank API searches

nbscraper Overview This simple tool automates the process of copying, pasting, and organizing data from NewsBank API searches. Curerntly, nbscrape onl

0 Jun 17, 2021
A Powerful Spider(Web Crawler) System in Python.

pyspider A Powerful Spider(Web Crawler) System in Python. Write script in Python Powerful WebUI with script editor, task monitor, project manager and

Roy Binux 15.7k Jan 04, 2023
Scraping web pages to get data

Scraping Data Get public data and save in database This is project use Python How to run a project 1 - Clone the repository 2 - Install beautifulsoup4

Soccer Project 2 Nov 01, 2021
Twitter Scraper

Twitter's API is annoying to work with, and has lots of limitations — luckily their frontend (JavaScript) has it's own API, which I reverse–engineered. No API rate limits. No restrictions. Extremely

Tayyab Kharl 45 Dec 30, 2022
Fundamentus scrapy

Fundamentus_scrapy Baixa informacões que os outros scrapys do fundamentus não realizam. Para iniciar (python main.py), sera criado um arquivo chamado

Guilherme Silva Uchoa 1 Oct 24, 2021
Scraping and visualising India's real-time COVID-19 data from the MOHFW dataset.

COVID19-WEB-SCRAPER Open Source Tech Lab - Project [SEMESTER IV] OSTL Assignments OSTL Assignments - 1 OSTL Assignments - 2 Project COVID19 India Data

AMEY THAKUR 8 Apr 28, 2022
Comment Webpage Screenshot is a GitHub Action that captures screenshots of web pages and HTML files located in the repository

Comment Webpage Screenshot is a GitHub Action that helps maintainers visually review HTML file changes introduced on a Pull Request by adding comments with the screenshots of the latest HTML file cha

Maksudul Haque 21 Sep 29, 2022
Webservice wrapper for hhursev/recipe-scrapers (python library to scrape recipes from websites)

recipe-scrapers-webservice This is a wrapper for hhursev/recipe-scrapers which provides the api as a webservice, to be consumed as a microservice by o

1 Jul 09, 2022
Web Scraping OLX with Python and Bsoup.

webScrap WebScraping first step. Authors: Paulo, Claudio M. First steps in Web Scraping. Project carried out for training in Web Scrapping. The export

claudio paulo 5 Sep 25, 2022
A simplistic scraper made to download tons of random screenshots made by people.

printStealer 1.1 What is this tool? This tool is developed to show the insecurity of the screenshot utility called prnt sc. It is a site that stores s

appelsiensam 4 Jul 26, 2022
Libextract: extract data from websites

Libextract is a statistics-enabled data extraction library that works on HTML and XML documents and written in Python

499 Dec 09, 2022
Demonstration on how to use async python to control multiple playwright browsers for web-scraping

Playwright Browser Pool This example illustrates how it's possible to use a pool of browsers to retrieve page urls in a single asynchronous process. i

Bernardas Ališauskas 8 Oct 27, 2022
Binance Smart Chain Contract Scraper + Contract Evaluator

Pulls Binance Smart Chain feed of newly-verified contracts every 30 seconds, then checks their contract code for links to socials.Returns only those with socials information included, and then submit

14 Dec 09, 2022
This code will be able to scrape movies from a movie website and also provide download links to newly uploaded movies.

Movies-Scraper You are probably tired of navigating through a movie website to get the right movie you'd want to watch during the weekend. There may e

1 Jan 31, 2022
Scraping script for stats on covid19 pandemic status in Chiba prefecture, Japan

About 千葉県の地域別の詳細感染者統計(Excelファイル) をCSVに変換し、かつ地域別の日時感染者集計値を出力するスクリプトです。 Requirement POSIX互換なシェル, e.g. GNU Bash (1) curl (1) python = 3.8 pandas = 1.1.

Conv4Japan 1 Nov 29, 2021
a high-performance, lightweight and human friendly serving engine for scrapy

a high-performance, lightweight and human friendly serving engine for scrapy

Speakol Ads 30 Mar 01, 2022
Instagram profile scrapper with python

IG Profile Scrapper Instagram profile Scrapper Just type the username, and boo! :D Instalation clone this repo to your computer git clone https://gith

its Galih 6 Nov 07, 2022
Python Web Scrapper Project

Web Scrapper Projeto desenvolvido em python, sobre tudo com Selenium, BeautifulSoup e Pandas é um web scrapper que puxa uma tabela com as principais e

Jordan Ítalo Amaral 2 Jan 04, 2022
UdemyBot - A Simple Udemy Free Courses Scrapper

UdemyBot - A Simple Udemy Free Courses Scrapper

Gautam Kumar 112 Nov 12, 2022
Scrape data on SpaceX: Capsules, Rockets, Cores, Roadsters, SpaceX Info

SpaceX Sofware I developed software to scrape data on SpaceX: Capsules, Rockets, Cores, Roadsters, SpaceX Info to use the software you need Python a

Maxence Rémy 16 Aug 02, 2022