Empresas do Brasil (CNPJs)

Overview

Empresas do Brasil (CNPJs)

Biblioteca em Python que coleta informações cadastrais de empresas do Brasil (CNPJ) obtidas de fontes oficiais (Receita Federal do Brasil - RFB) e exporta para um formato legível por humanos (CSV ou JSON).

Python library that collects cadastral information of companies from Brazil (CNPJ) provided by official sources (Federal Revenue of Brazil - RFB) and exports results to a human-readable format (CSV or JSON).

Instalação

pip install -e git+https://github.com/br-api/empresas-brasil.git

Biblioteca

Esta biblioteca é um cliente da API Empresas do Brasil fornecida via plataforma RapidAPI. Para usa-lá é necessário a criação de um usuário no RapidAPI e assinatura da API para obter uma chave privada para fazer requisições HTTP. Porém, para fins didáticos, você pode usar a seguinte chave de maneira gratuita:

  • RAPID_API_KEY=ea67d6a65emshb685a95313a55ccp1b132bjsnb5e966cbb0cf

Exemplo para coletar informações de uma única empresa pelo CNPJ:

>> companies = client.get_many( tax_ids=["00394460005887"] # CNPJ ) ">
>>> from empresas_brasil.client import BrazilCompanyClient
>>> client = BrazilCompanyClient(api_key="ea67d6a65emshb685a95313a55ccp1b132bjsnb5e966cbb0cf")
>>> companies = client.get_many(
    tax_ids=["00394460005887"] # CNPJ
)

Exemplo para coletar informações de múltiplas empresas pelo CNPJ:

>> companies = client.get_many( tax_ids=["00394460005887", "00396895004201"] # CNPJs ) ">
>>> from empresas_brasil.client import BrazilCompanyClient
>>> client = BrazilCompanyClient(api_key="ea67d6a65emshb685a95313a55ccp1b132bjsnb5e966cbb0cf")
>>> companies = client.get_many(
    tax_ids=["00394460005887", "00396895004201"] # CNPJs
)

CLI

Como alternativa, use o comando abaixo em um terminal para armazenar os resultados num arquivo .csv:

export RAPID_API_KEY=ea67d6a65emshb685a95313a55ccp1b132bjsnb5e966cbb0cf
empresas_brasil --key $RAPID_API_KEY --id 00394460005887 --id 00396895004201 --path exemplo.csv

Ou use o comando abaixo em um terminal para armazenar os resultados num arquivo .json:

empresas_brasil --key $RAPID_API_KEY --id 00394460005887 --id 00396895004201 --path exemplo.json

Schema

Schema de informações coletadas de uma empresa:

{
    "type": "object",
    "properties": {
        "taxIdNumber": {
            "type": "string",
            "description": "Número do documento (CNPJ no Brasil)"
        },
        "officialName": {
            "type": "string",
            "description": "Nome oficial (razão social) da empresa"
        },
        "tradeName": {
            "type": "string",
            "description": "Nome fantasia da empresa"
        },
        "creationDate": {
            "type": "string",
            "description": "Data de criação do registro referente a empresa"
        },
        "size": {
            "type": "string",
            "description": "Porte da empresa"
        },
        "legalNature": {
            "type": "string",
            "description": "Descrição da natureza jurídica da empresa"
        },
        "meiOptant": {
            "type": "string",
            "description": "Indicador da existência da opção pelo Microempreendedor Individual (MEI)"
        },
        "simplesOptant": {
            "type": "string",
            "description": "Indicador da existência da opção pelo registro tributário Simples Nacional"
        },
        "partnershipType": {
            "type": "string",
            "description": " Indicador se é Matriz ou Filial"
        },
        "taxIdStatus": {
            "type": "string",
            "description": "Status da empresa na Receita Federal"
        },
        "taxIdStatusDate": {
            "type": "string",
            "description": "Data de atualização do status da empresa na Receita Federal"
        },
        "addressStreet": {
            "type": "string",
            "description": "'Nome do logradouro onde se localiza a empresa"
        },
        "addressDetails": {
            "type": "string",
            "description": "Complemento para o endereço de localização da empresa"
        },
        "addressNeighborhood": {
            "type": "string",
            "description": "Bairro onde se localiza a empresa"
        },
        "addressZipCode": {
            "type": "string",
            "description": "Código de endereçamento postal referente ao logradouro no qual a empresa esta localizada."
        },
        "addressCity": {
            "type": "string",
            "description": "Município de jurisdição onde se encontra a empresa"
        },
        "addressState": {
            "type": "string",
            "description": "Unidade da federação em que se encontra a empresa"
        },
        "economicActivities": {
            "type": "array",
            "items": {
                "type": "object",
                "description": "Lista de atividades econômicas registradas pela empresa",
                "properties": {
                    "code": {
                        "type": "string",
                        "description": "Código da atividade econômica"
                    },
                    "description": {
                        "type": "string",
                        "description": "Descrição atividade econômica"
                    },
                    "isMain": {
                        "type": "string",
                        "description": "Indicador se atividade econômica é primária"
                    }
                }
            }
        }
    }
}

Referência

Licença

A licença do código é LGPL3 e dos dados convertidos Creative Commons Attribution ShareAlike. Caso utilize os dados, cite a fonte original e quem tratou os dados, como: Fonte: Receita Federal do Brasil. Caso compartilhe os dados, utilize a mesma licença.

Owner
BR-API: Democratizando dados do Brasil.
Brazilian API - Democratizing data from Brazil.
BR-API: Democratizando dados do Brasil.
Draw random mazes in python

a-maze Draw random mazes in python This program generates and draws a rectangular maze, with an entrance on one side and one on the opposite side. The

Andrea Pasquali 1 Nov 21, 2021
Sample python script for monitoring Rocketchat database and get statistics of users.

rocketchat-DB-monitoring Sample python script for monitoring Rocketchat database and get statistics of users. 1. Update python: yum check-update && yu

Mojtaba Taleghani 1 Apr 12, 2022
Hacktoberfest2021 🥳- Contribute Any Pattern In Any Language😎 Every PR will be accepted Pls contribute

✨ Hacktober Fest 2021 ✨ 🙂 All Contributors are requested to star this repo and follow me for a successful merge of pull request. 🙂 👉 Add any patter

Md. Almas Ali 103 Jan 07, 2023
A NetBox Plugin that gives a UI for generating, comparing and deploying configurations to devices.

netbox_config_plugin - A plugin to generate, compare and deploy configurations This plugin allows you to execute your code to generate a config for a

Jo 11 Dec 21, 2022
A script that convert WiiU BotW mods to Switch

UltimateBoTWConverter A script that convert WiiU BotW mods to Switch. It uses every resource I could find under the sun that allows for conversion, wi

11 Nov 08, 2022
Sudo type me a payload

payloadSecretary Sudo type me a payload Have you ever found yourself having to perform a test, and a client has provided you with a VM inside a VDI in

7 Jul 21, 2022
Passenger Car Unit (PCU) Calculator

This is a streamlit web application which can be used to calculate Passenger Car Unit (PCU) values for a selected road section.

Dineth Dhananjaya 1 Apr 26, 2022
Anonfiles files leaker via keyword.

Anonfiles files leaker via keyword

Trac3D1y 6 Nov 23, 2022
Strawberry Benchmark With Python

Strawberry benchmarks these benchmarks have been made to compare the performance of dataloaders and joined database queries. How to use You can run th

Doctor 4 Feb 23, 2022
KiCad bus length matching script.

KiBus length matching script This script implements way to monitor multiple nets, combined into a bus that needs to be length matched

Piotr Esden-Tempski 22 Mar 17, 2022
Cloud Native sample microservices showcasing Full Stack Observability using AppDynamics and ThousandEyes

Cloud Native Sample Bookinfo App Observability Bookinfo is a sample application composed of four Microservices written in different languages.

Cisco DevNet 13 Jul 21, 2022
Participants of Bertelsmann Technology Scholarship created an awesome list of resources and they want to share it with the world, if you find illegal resources please report to us and we will remove.

Participants of Bertelsmann Technology Scholarship created an awesome list of resources and they want to share it with the world, if you find illegal

Wissem Marzouki 29 Nov 28, 2022
A passive recon suite designed for fetching the information about web application

FREAK Suite designed for passive recon Usage: python3 setup.py python3 freak.py warning This tool will throw error if you doesn't provide valid api ke

toxic v3nom 7 Feb 17, 2022
A utility control surface for Ableton Live that makes the initialization of a Mixdown quick

Automate Mixdown initialization A script that transfers all the VSTs on your MIDI tracks to a new track so you can freeze your MIDI tracks and then co

Aarnav 0 Feb 23, 2022
Like Docker, but for Squeak. You know, for kids.

Squeaker Like Docker, but for Smalltalk images. You know, for kids. It's a small program that helps in automated derivation of configured Smalltalk im

Tony Garnock-Jones 14 Sep 11, 2022
A free and powerful system for awareness and research of the American judicial system.

CourtListener Started in 2009, CourtListener.com is the main initiative of Free Law Project. The goal of CourtListener.com is to provide high quality

Free Law Project 332 Dec 25, 2022
Very Simple 2 Message Spammer!

Very Simple 2 Message Spammer!

Syntax. 4 Dec 06, 2022
Albert launcher extension for rolling dice.

dice-roll-albert-ext Extension for rolling dice in Albert launcher Installation Locate the modules directory in the Python extension data directory. T

Jonah Lawrence 1 Nov 18, 2021
Kolibri: the offline app for universal education

Kolibri This repository is for software developers wishing to contribute to Kolibri. If you are looking for help installing, configuring and using Kol

Learning Equality 564 Jan 02, 2023
A10 cipher - A Hill 2x2 cipher that totally gone wrong

A10_cipher This is a Hill 2x2 cipher that totally gone wrong, it encrypts with H

Caner Çetin 15 Oct 19, 2022