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.
System Design Assignments as part of Arpit's System Design Masterclass

System Design Assignments The repository contains a set of problem statements around Software Architecture and System Design as conducted by Arpit's S

Relog 1.1k Jan 09, 2023
A numbers extract from string python package

Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/FayasNoushad/Numbers-Extract/blob/main/LICENS

Fayas Noushad 4 Nov 28, 2021
Heads Down Application for Mac OSX

Heads Down A Mac app that lives in your ribbon—with a click of the mouse, temporarily block distracting websites and applications to encourage "heads

20 Mar 10, 2021
Mannaggia is a python application to praise or more likely to curse the saints

Mannaggia-py 👼 Remember Mannaggia? This is a Python remake of it, with new features. mannaggia is a python application to praise or more likely to cu

Christian Visintin 9 Aug 12, 2022
STAC in Jupyter Notebooks

stac-nb STAC in Jupyter Notebooks Install pip install stac-nb Usage To use stac-nb in a project, start Jupyter Lab (jupyter lab), create a new noteboo

Darren Wiens 32 Oct 04, 2022
Advanced Keylogger in Python

Advanced Keylogger in Python Important Disclaimer: The author will not be held r

Suvanth Erranki 1 Feb 07, 2022
Python Project For Beginner

Basic-Vitrual-AI-Assistant Python Project For Beginner Hey There, I had manipulated Selenium WebDriver to make this assistant. I hope, It will be help

Maruf Billah 13 Dec 12, 2022
Simple tools to make/dump CPC+ CPR cartridge files

Simple tools to make/dump CPC+ CPR cartridge files mkcpr.py: make a CPR file from files (one chunk per file); see notes cprdump.py: dump the chunks of

Juan J. Martínez 3 May 30, 2022
[Cython] Vs [Python] Which one is Faster ?

[Cython] Vs [Python] ? Attractive Contrast :) Mission : Which one is Faster ? Comparing of Execution runtime for [Selection_sort] with Time Complexity

baqer marani 1 Dec 05, 2021
Make after-work Mending More flexible In Python

Mending Make after-work Mending More flexible In Python A Lite Package focuses on making project's after-post mending pythonic and flexible. Certainly

2 Jun 15, 2022
Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python

Scalene: a high-performance CPU, GPU and memory profiler for Python by Emery Berger, Sam Stern, and Juan Altmayer Pizzorno. Scalene community Slack Ab

PLASMA @ UMass 7k Dec 30, 2022
Automate your Microsoft Learn Student Ambassadors event certificate with Python

Microsoft Learn Student Ambassador Certificate Automation This repo simply use a template certificate docx file and generates certificates both docx a

Muhammed Oğuz 24 Aug 24, 2022
A set of tools for ripping music from Konami mobile games

Konami Mobile Ripping Toolset A set of tools for ripping music from Konami mobile games Contents nigger.py for niggering konami's website, ripping all

5 Oct 20, 2022
Automate the boilerplate while initializing your Python project

Rubric Automate the boilerplate while initializing your Python project Preface Rubric is an opinionated project initializer for Python. It assum

Redowan Delowar 23 Dec 16, 2022
UUID_ApiGenerator - This an API that will return a key-value pair of randomly generated UUID

This an API that will return a key-value pair of randomly generated UUID. Key will be a timestamp and value will be UUID. While the

1 Jan 28, 2022
A flexible free and unlimited python tool to translate between different languages in a simple way using multiple translators.

deep-translator Translation for humans A flexible FREE and UNLIMITED tool to translate between different languages in a simple way using multiple tran

Nidhal Baccouri 806 Jan 04, 2023
Py-Parser est un parser de code python en python encore en plien dévlopement.

PY - PARSER Py-Parser est un parser de code python en python encore en plien dévlopement. Une fois achevé, il servira a de nombreux projets comme glad

pf4 3 Feb 21, 2022
Export transactions for an algorand wallet to a CSV file

algorand_txn_csv_exporter - (Algorand transaction CSV exporter) This script will export transactions for an algorand wallet to a CSV file. It is inten

TeneoPython01 5 Jun 19, 2022
This Program Automates The Procces Of Adding Camos On Guns And Saving Them On Modern Warfare Guns

This Program Automates The Procces Of Adding Camos On Guns And Saving Them On Modern Warfare Guns

Flex Tools 6 May 26, 2022
A free website that keeps the people informed about housing and evictions.

Eviction Tracker Currently helping verify detainer warrant data for middle Tennessee - via Middle TN DSA - Red Door Collective Features Presents data

Red Door Collective 7 Dec 14, 2022