Install OpenDartReader via uv
masterYou can install the opendartreader CLI tool using uv tool. This is recommended for CLI users and AI agents.
uv tool install opendartreader
# To upgrade
uv tool install --upgrade opendartreaderrepository·master·Indexed 19 days ago
https://github.com/financedata/opendartreaderA Python library and CLI tool designed to simplify access to the South Korean Financial Supervisory Service's 'Open DART' API. It provides functionality to search for corporate disclosures, retrieve company profiles, download original disclosure documents, and extract financial statements, shareholder information, and business report items into pandas DataFrames. Version 0.3.2.
You can install the opendartreader CLI tool using uv tool. This is recommended for CLI users and AI agents.
uv tool install opendartreader
# To upgrade
uv tool install --upgrade opendartreaderIn your Python code, you can initialize the client by passing the API key directly or by relying on the environment variables configured above.
from opendartreader import OpenDartReader
# Option 1: Explicit API key
dart = OpenDartReader('your_api_key_here')
# Option 2: Rely on DART_API_KEY environment variable
dart = OpenDartReader()from opendartreader import OpenDartReader
dart = OpenDartReader('your_api_key_here')You can install or upgrade the opendartreader package using pip.
# Install
pip install opendartreader
# Upgrade
pip install --upgrade opendartreaderOpenDartReader requires an API key from the Open DART service. You can provide this key in two ways:
.env file: Create a .env file in your project root or home directory.# Option 1: .env file
DART_API_KEY="your_api_key_here"
# Option 2: Environment variable
export DART_API_KEY="your_api_key_here"You can install the library using uv for CLI automation or pip for Python development.
For CLI users:
uv tool install opendartreaderFor Python developers:
pip install opendartreaderuv tool install opendartreaderTo use the library, you must create an OpenDartReader object. You can provide your API key directly during initialization, or set it as an environment variable named DART_API_KEY. Using an environment variable (e.g., in a .env file) is recommended.
import OpenDartReader
# Option 1: Specify API key directly
api_key = 'YOUR_API_KEY'
dart = OpenDartReader(api_key)
# Option 2: Use environment variable DART_API_KEY (Recommended)
# If DART_API_KEY is set in your environment, you can initialize without arguments
dart = OpenDartReader()import OpenDartReader
# Option 1: Specify API key directly
api_key = 'YOUR_API_KEY'
dart = OpenDartReader(api_key)
# Option 2: Use environment variable DART_API_KEY (Recommended)
dart = OpenDartReader()OpenDartReader requires an API key from the Open DART service. The library automatically looks for an environment variable named DART_API_KEY or a .env file containing it.
Unix/macOS:
export DART_API_KEY="your_api_key_here"Windows (current session):
set DART_API_KEY=your_api_key_hereUsing a .env file:
Create a .env file in your project directory:
DART_API_KEY="your_api_key_here"export DART_API_KEY="your_api_key_here"You can retrieve and save files attached to a specific disclosure report.
Workflow:
attach_files(rcp_no).download(url, fn) to save them.Methods:
attach_files(rcp_no): Returns a dict of {file_name: url}.download(url, fn): Saves the file from url to the path fn.Example:
rcp_no = '20220308000798'
files = dart.attach_files(rcp_no)
for title, url in files.items():
dart.download(url, title)# Attach files and download them
rcp_no = '20220308000798'
files = dart.attach_files(rcp_no)
for title, url in files.items():
dart.download(url, title)You can install the library using pip.
To install:
pip install opendartreaderTo upgrade an existing installation:
pip install --upgrade opendartreaderpip install opendartreaderTo use the library, you must first create an OpenDartReader object using an API key. You can obtain an API key by registering on the Open DART authentication key application page. The key consists of 40 alphanumeric characters.
import OpenDartReader
api_key = 'YOUR_API_KEY'
dart = OpenDartReader(api_key)import OpenDartReader
api_key = 'd81e78ac719d1c1e4ec4558ef22a737ab6cbb4c8'
dart = OpenDartReader(api_key)The OpenDartReader CLI requires a DART API Key to function. You can provide the key in two ways:
DART_API_KEY environment variable in your shell. This is the recommended method for persistent use.--api-key flag directly to the command.If no key is provided via either method, the CLI will exit with an error.
# Using environment variable (recommended)
export DART_API_KEY='your_api_key_here'
python -m opendartreader.cli list SamsungElectronics
# Using CLI flag
python -m opendartreader.cli --api-key 'your_api_key_here' list SamsungElectronicsTo use the library, instantiate the OpenDartReader class. You must provide a DART API key either as a direct argument or by setting the DART_API_KEY environment variable. The class automatically manages a local cache directory named docs_cache to store corporate code data for performance.
from opendartreader import OpenDartReader
# Option 1: Pass API key directly
dart = OpenDartReader(api_key='YOUR_API_KEY')
# Option 2: Use environment variable DART_API_KEY
# dart = OpenDartReader()