Skip to main content

An API for accessing a Polish REGON database

Project description

litex.regon - a frontend for Polish REGON database

Simple, pythonic wrapper for REGON database (web frontend is reachable at https://wyszukiwarkaregon.stat.gov.pl/appBIR/index.aspx). To access its SOAP API, one needs an USER_KEY issued by REGON administrators available at Regon_Bir@stat.gov.pl.

Usage example below:

>>> from litex.regon import REGONAPI

REGONAPI accepts one argument: service URL (provided by REGON Administrators).

>>> api = REGONAPI(SERVICE_URL)

First, one needs to log in (using provided user key)

>>> api.login(USER_KEY)

After login, one can start querying the database. The search method accepts the following parameters:

  • regon - single REGON number (either 9 or 14 digits long)
  • krs - single 10 digit KRS number
  • nip - single NIP (10 digits string)
  • regons - a collection of REGONs (all of them have to be either 14 or 9 digits long)
  • krss - a collection of KRSs
  • nips - a collection of NIPs

Only one parameter is used in the query. If multiple ones are passed, first from the above list is taken into account.

Additionally, a detailed parameter can be passed: detailed=True causes search method to fetch default detailed report.

>>> entities = api.search(nip='9999999999')

entities is a list of LXML objectify objects wrapping the search results (up to 100). If search was called with detailed=True, the full report is available as the detailed attribute.

If one knows the REGON of a business entity and an detailed report name, a full report can be fetched directly:

>>> detailed_report = api.full_report('99999999', 'PublDaneRaportFizycznaOsoba')

Summary report with a list of REGONs for the given criteria can be fetched by:

>>> summary_report = api.summary_report(
        '2020-01-01', 
        'BIR11NowePodmiotyPrawneOrazDzialalnosciOsFizycznych'
    )

Report names can be found in the documentation provided by REGON admins.

Changes

1.0.8

  • full_report and summary_report now raise REGONAPIError on empty result with detailed error information (thanks to @wolkiewiczk for suggestion)

1.0.7

  • compatibility with requests >= 2.28 (thanks to @wolkiewiczk for spotting this)

1.0.6

  • more meaningful error messages in search method (thanks @m-ganko)
  • summary reports (also kudos to @m-ganko)

1.0.5

  • reworked REGON cleanup logic (in search function, when fetching detailed report)
  • search method now uses DaneSzukajPodmioty (API version 1.1) call instead of DaneSzukaj (thanks to @kicaj for pull request)

1.0.4

  • migration from nose to py.test
  • tox configuration for Python 2 and 3 testing
  • improved handling of detailed reports (thanks to @miloszsobiczewski for logging an issue)

1.0.3

  • Python 3.6 compatibility (thanks to Mariusz Witek)

1.0.2

  • CAPTCHA removal -- no longer needed in current API

1.0.1

  • detailed report fetching logic reworked

1.0.0

  • initial release

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

litex_regon-1.0.8.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

litex_regon-1.0.8-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file litex_regon-1.0.8.tar.gz.

File metadata

  • Download URL: litex_regon-1.0.8.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for litex_regon-1.0.8.tar.gz
Algorithm Hash digest
SHA256 e55f7d820ee2f2fb34f6ab6e8869bcfecf3b9fd0e7d1ed99693473229c4e26ce
MD5 621189f42fe5d1129893fdfad2190ba9
BLAKE2b-256 71617a8d9b8e688be8327af69b5075064c785808175ff933d6231e400b5946ac

See more details on using hashes here.

File details

Details for the file litex_regon-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: litex_regon-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for litex_regon-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 284b5d1b74df1afe0ac6893296bdd818e113ac0747e29f71ce09643c30f2c2e4
MD5 37d9cbb4f991786b6264053b17eda8ab
BLAKE2b-256 3b9eace7a1cdb6682c23df5bdfc677ffda4c5952132a37263a409a2a93eb72e2

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