Skip to main content

Task-level Python interface for loading Korean legal sources from law.go.kr

Project description

MOLEG-API

MOLEG-API is a task-level Python interface for loading Korean legal sources from law.go.kr. It is designed for applications and agent systems that need normalized legal context without memorizing individual MOLEG OpenAPI target values, identifier rules, or response-shape quirks.

The Python package name is moleg-api; import it as moleg_api.

This is not a complete wrapper around every law.go.kr endpoint. The public interface is intentionally small and deep: search or plan first, then load the selected legal source text, authority detail, delegated rule context, or annex/form body.

Install

After the package is published:

pip install moleg-api

From a repository checkout:

python -m pip install .

Live law.go.kr calls require an OpenAPI credential in MOLEG_OC:

export MOLEG_OC="your-law-go-kr-oc"

Quick Example

from moleg_api import MolegApi

api = MolegApi()

hits = api.search_laws("자동차관리법", basis="effective", display=5)
selected = hits[0].identity

article = api.get_article(selected, "제26조", basis="effective")
print(article.text)

For broader questions, use a staged bundle and inspect deferred follow-ups:

bundle = api.load_legal_context_bundle(
    query="자동차 방치 처리 기준",
    mode="question",
    budget="standard",
)

for lookup in bundle.deferred:
    if lookup.interface == "load_administrative_rule_context":
        rule_context = api.load_followup(lookup)
        break

Public dataclasses serialize recursively:

payload = bundle.to_dict()                  # omits raw source payloads
debug_payload = bundle.to_dict(include_raw=True)
json_text = bundle.to_json_string()

What It Covers

  • Current and promulgated statutes
  • Statute articles, including moved/deleted article status
  • Supplementary provisions
  • Law history and before/after text comparison
  • Delegated rules and legal hierarchy
  • Administrative rules, notices, directives, and established rules
  • Law and administrative-rule annex/form body loading
  • MOLEG official interpretations and ministry first-instance interpretations
  • Ordinary court cases and Constitutional Court decisions
  • Query expansion and comparable-mechanism discovery
  • Staged context bundles with executable follow-up lookups

Documentation

Consumer-specific notes for a future legislative-expert skill remain in docs/SKILL-INTEGRATION.md and docs/SKILL-AUTHOR-COOKBOOK.md. They are examples of one integration, not the package's general-purpose contract.

Status

The package is alpha (0.1.x). The interface is ready for package-level experimentation, but law.go.kr live behavior can vary by source, credential, and endpoint availability. Treat search results as candidates until selected detail loaders have retrieved source text.

This package is a legal-source loader, not legal advice.

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

moleg_api-0.1.0.tar.gz (153.9 kB view details)

Uploaded Source

Built Distribution

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

moleg_api-0.1.0-py3-none-any.whl (70.4 kB view details)

Uploaded Python 3

File details

Details for the file moleg_api-0.1.0.tar.gz.

File metadata

  • Download URL: moleg_api-0.1.0.tar.gz
  • Upload date:
  • Size: 153.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for moleg_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 76ee608d5a02b2f9e875e4558a3bc2460c281994366c333273ce4d33e742f041
MD5 35f63414614d675f947aa1139e6183d8
BLAKE2b-256 dee96f7107297a6ebbc91ba471862b6398b6476cd1c54e2b87754ba030ffd6b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for moleg_api-0.1.0.tar.gz:

Publisher: workflow.yml on tjdwls101010/MOLEG-API

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moleg_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: moleg_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 70.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for moleg_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d912e03a35f9d1cd3905d8c6a472b68b020bedb374c50088d6a726789b7e6be
MD5 9709f057b30769b3c9f03c8729b60d25
BLAKE2b-256 7e0bb98f6c2747a446f636834c26bd3069096759161c88ff241d6d70903537c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for moleg_api-0.1.0-py3-none-any.whl:

Publisher: workflow.yml on tjdwls101010/MOLEG-API

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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