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.
Tracking stock volatility.

SP500-highlow-tracking Track stock volatility. Being a useful indicator of the stock price volatility, High-Low gap represents the price range of the

Thong Huynh 13 Sep 07, 2022
Incident Response Process and Playbooks | Goal: Playbooks to be Mapped to MITRE Attack Techniques

PURPOSE OF PROJECT That this project will be created by the SOC/Incident Response Community Develop a Catalog of Incident Response Playbook for every

Austin Songer 987 Jan 02, 2023
A python script to turn tabs into spaces the right way.

detab A python script to turn tabs into spaces the right way. detab turns all tabs into spaces, not just leading tabs. Not all tabs have the same leng

1 Jan 26, 2022
DeDRM tools for ebooks

DeDRM_tools DeDRM tools for ebooks This is a fork of Apprentice Harper's version of the DeDRM tools. I've added some of the PRs that still haven't bee

2 Jan 10, 2022
A repository containing an introduction to Panel made to be support videos and talks.

👍 Awesome Panel - Introduction to Panel THIS REPO IS WORK IN PROGRESS. PRE-ALPHA Panel is a very powerful framework for exploratory data analysis and

Marc Skov Madsen 51 Nov 17, 2022
Gobigger Explore For Python

Gobigger-Explore 🔮 GoBigger Challenge 2021 Baseline en/中文 🤖 Introduction This is the baseline of GoBigger Multi-Agent Decision Intelligence Challeng

OpenDILab 145 Dec 22, 2022
python3 scrip for case conversion of source code files writen in fixed form fortran

convert_FORTRAN_case python3 scrip for case conversion of source code files writen in fixed form fortran python3 scrip for case conversion of source c

7 Sep 20, 2022
Generate PNG filles from NFO files.

Installation git clone https://github.com/pcroland/nfopng cd nfopng pip install -r requirements.txt Usage ❯ ./nfopng.py usage: nfopng.py [-h] [-v] [-i

4 Jun 26, 2022
Opendrop - An open Apple AirDrop implementation written in Python

OpenDrop: an Open Source AirDrop Implementation OpenDrop is a command-line tool that allows sharing files between devices directly over Wi-Fi. Its uni

Secure Mobile Networking Lab 7.5k Jan 03, 2023
Would upload anything I do with/related to brainfuck

My Brainfu*k Repo Basically wanted to create something with Brainfu*k but realized that with the smol brain I have, I need to see the cell values real

Rafeed 1 Mar 22, 2022
Python samples for Google Cloud Platform products.

Google Cloud Platform Python Samples Python samples for Google Cloud Platform products. Setup Install pip and virtualenv if you do not already have th

Google Cloud Platform 6k Jan 03, 2023
Polypheny Connector for Python

Polypheny Connector for Python This enables Python programs to access Polypheny databases, using an API that is compliant with the Python Database API

Polypheny 3 Jan 03, 2022
Repository voor verhalen over de woningbouw-opgave in Nederland

Analyse plancapaciteit woningen In deze notebook zetten we cijfers op een rij om de woningbouwplannen van Nederlandse gemeenten in kaart te kunnen bre

Follow the Money 10 Jun 30, 2022
3x+1 recreated in Python

3x-1 3x+1 recreated in Python If a number is odd it is multiplied by 3 and 1 is added to the product. If a number is even it is divided by 2. These ru

4 Aug 19, 2022
This repository contains all the data analytics projects that I've worked on in python.

93_Python_Data_Analytics_Projects This repository contains all the data analytics projects that I've worked on in python. No. Name 01 001_Cervical_Can

Milaan Parmar / Милан пармар / _米兰 帕尔马 267 Jan 06, 2023
Project 2 for Microsoft Azure on WUT

azure-proj2 Project 2 for Microsoft Azure on WUT Table of contents Team Tematyka projektu Architektura Opis rozwiązania Demo dzałania The Team Krzyszt

1 Dec 07, 2021
プレヤフHackUチーム「キャット・タン」が作成したアプリ「illustection」

cat_tongue_illustection プレヤフHackUチーム「キャット・タン」が作成した, プライバシー保護アプリ「illustection」です! デモ動画 https://youtu.be/z3I7LuB_i58 機能 アップロードされた画像をいい感じのイラストやの素材に置き換える(

4 Jul 03, 2021
Step by step development of a vending coffee machine project, including tkinter, sqlite3, simulation, etc.

Step by step development of a vending coffee machine project, including tkinter, sqlite3, simulation, etc.

Nikolaos Avouris 2 Dec 05, 2021
Linux Backlight Manager

Is a program to manage your laptop keyboard backlights in linux. Tested on Tuxedo / Clevo / Monste models. Must be tested on other devices

Arshia Ihammi 4 Jan 14, 2022
Logging-monitoring-instrumentation - A brief repository on logging monitoring and instrumentation in Python

logging-monitoring-instrumentation A brief repository on logging monitoring and

Noah Gift 6 Feb 17, 2022