Skip to main content

Python library to fetch CNPJ data from OpenCNPJ API

Project description

Python OpenCNPJ Library

License

Python library to fetch Brazilian CNPJ company data via OpenCNPJ.


🚀 Features

  • Query company information by CNPJ
  • Check if a CNPJ exists
  • Utility function: Format CNPJ

📦 Installation

pip install python-opencnpj  

🔧 Use cases

Fetch company informations

from opencnpj import OpenCnpj

# Initialize client
client = OpenCnpj()

data = client.get("12345678000195")

print(data["razao_social"])

Check if CNPJ exists

from opencnpj import OpenCnpj

# Initialize client
client = OpenCnpj()

exists = client.exists("12.345.678/0001-95")

if exists:
    print('Exists!')
else:
    print('Does not exists!')

Format to readable CNPJ

from opencnpj import OpenCnpj

# Initialize client
client = OpenCnpj()

read_cnpj = client.format_cnpj("123456780001-95")

print(read_cnpj)

#### OUTPUT ####
# - 12.345.678/0001-95

Working under a proxy server

from opencnpj import OpenCnpj

proxies = {
    "http": "http://your_proxy_ip:port",
    "https": "http://your_proxy_ip:port",
}

# Initialize client
client = OpenCnpj(proxies=proxies)

data = client.get("123456780001-95")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_opencnpj-0.1.4.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_opencnpj-0.1.4-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file python_opencnpj-0.1.4.tar.gz.

File metadata

  • Download URL: python_opencnpj-0.1.4.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for python_opencnpj-0.1.4.tar.gz
Algorithm Hash digest
SHA256 921b4f2e8b718809adbb581419f03f37c5924b8f3a4eaa802d1523b879c1779d
MD5 44ee8944085a7b0af42b4f3c38ee473a
BLAKE2b-256 01c39012f50afaee0e304311b162492250f9c06e999e36dc18fc95ee365685d6

See more details on using hashes here.

File details

Details for the file python_opencnpj-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for python_opencnpj-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3a8f19f0eefa0cc45df6d7a2ce70875a7a6096f11c61dced6d9806f5ebe14389
MD5 5934ce3b6b25c9731eeb5c2404354f09
BLAKE2b-256 34526a101c78935bc94693042a5690026f59ceecfb462c73e6cf0359f7a3115c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page