🎓 PDDIKTI API Python Library
An unofficial Python wrapper for the Indonesian Higher Education Database (PDDIKTI, Kemdiktisaintek).
pddiktipy gives you a clean, typed interface to student, lecturer, university,
and study-program data from PDDIKTI,
with connection pooling, retries, validation, and comprehensive error handling.
📋 Table of Contents
- Features
- Installation
- Cloudflare access (read this first)
- Quick Start
- Error Handling
- Documentation
- Requirements
- Testing
- Contributing
- License
🚀 Features
- ✅ 70+ endpoints: search, details, statistics, and visualizations
- ✅ Full type hints for good editor support
- ✅ Robust error handling with custom exceptions and input validation
- ✅ Context manager support for clean resource management
- ✅ Connection pooling & retries out of the box
- ✅ Transparent AES-256 decryption for the encrypted search endpoint
📦 Installation
pip install pddiktipy
To let the client read the Cloudflare clearance cookie from your local browser automatically (see below), install the optional extra:
pip install "pddiktipy[auto]"
🚨 Cloudflare access (read this first)
The upstream API (https://pddikti.kemdiktisaintek.go.id/api) is protected by a
Cloudflare Turnstile challenge. A plain HTTP client always receives 403,
so api() with no arguments will not work on its own. Only a real browser
can pass the challenge. Even automated browsers (Selenium/Playwright) are
blocked.
You therefore need to supply Cloudflare clearance in one of three ways.
Option A: auto cookie (easiest, on your own machine)
pip install "pddiktipy[auto]"
- Open
https://pddikti.kemdiktisaintek.go.idin Chrome or Edge and complete the "Verify you are human" check once. - Run your code. The client reads the
cf_clearancecookie for you:
from pddiktipy import api
with api(auto_cookie=True) as client:
print(client.get_pt_count()) # {'status': 'success', 'data': {'jumlah': 4416}}
Option B: paste the cookie manually (works on servers or other machines)
- Open the site in your browser and pass the check.
- Open DevTools (
F12) → Application → Cookies → select the site → copy the value ofcf_clearance. - In DevTools → Network, click any request → Headers → copy the
User-Agent(the cookie is bound to it).
from pddiktipy import api
client = api(
cf_clearance="PASTE_CF_CLEARANCE_HERE",
user_agent="PASTE_YOUR_BROWSER_USER_AGENT_HERE",
)
print(client.get_pt_count())
Option C: run your own solver proxy (most stable for production)
Point base_url at a service that solves Cloudflare for you (for example a
FlareSolverr-backed proxy that
forwards to the PDDIKTI upstream):
from pddiktipy import api
client = api(base_url="http://localhost:8080/api")
print(client.get_pt_count())
Note:
cf_clearanceis bound to your IP and User-Agent and expires after ~30 minutes. For long-running, unattended use, prefer Option C.
⚡ Quick Start
from pddiktipy import api
from pprint import pprint
# See "Cloudflare access" above for how to provide clearance.
with api(auto_cookie=True) as client:
# Search across all categories (payload is decrypted for you)
results = client.search_all("Universitas Diponegoro")
pprint(results)
# Search a specific category
students = client.search_mahasiswa("Ilham Riski Wibowo")
pprint(students)
# Aggregate statistics
print(client.get_pt_count()) # number of universities
print(client.get_mahasiswa_count_active()) # number of active students
A runnable example lives in examples/quickstart.py.
⚠ Error Handling
By default, API methods log and return None on failure rather than
raising, so everyday calls stay simple:
with api(auto_cookie=True) as client:
result = client.search_mahasiswa("") # invalid keyword -> None
if result is None:
print("No result / request failed")
The lower-level exceptions are still available if you build on top of the helper:
from pddiktipy.exceptions import (
ValidationError, APIConnectionError, APITimeoutError,
APIRateLimitError, APIResponseError, PDDIKTIError,
)
If the upstream returns a Cloudflare challenge, the client raises an
APIResponseError whose message explains exactly how to supply clearance.
📚 Documentation
➡️ API Documentation: every method, with parameters, examples, and response field descriptions.
📋 Requirements
- Python 3.7+
- requests
- cryptography
- browser_cookie3 (optional, only for
auto_cookie=True)
🧪 Testing
🧪 Testing Guide: how to run the test suite.
Offline tests (no network) can be run directly:
python -m pytest tests/test_crypto_and_endpoints.py -q
🤝 Contributing
🤝 Contributing Guide: how to contribute.
📄 License
Distributed under the MIT License.
📞 Support & Contact
- Author: Ilham Riski Wibowo
- Issues: GitHub Issues
- PyPI: pddiktipy
⭐ If this library helps your project, please consider starring it on GitHub!
Metadata
Release files for pddiktipy 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pddiktipy-2.2.0.tar.gz | 20.4 kB | Without provenance | Details for pddiktipy-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pddiktipy-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for pddiktipy-2.2.0-py3-none-any.whl |
Total release size: 41.2 kB
Release files / pddiktipy-2.2.0.tar.gz
| Download URL | pddiktipy-2.2.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d6b083120df580273e1a13c5136b112705b304419a4151b770588b9e4b535ed
|
|
BLAKE2b-256 checksum How to use checksums |
fcfab7ce1d4562b8ef6008c2b5aae467b22620b9cef50cd6d28c081900f48f7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pddiktipy-2.2.0-py3-none-any.whl
| Download URL | pddiktipy-2.2.0-py3-none-any.whl |
|---|---|
| Size | 20.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd318a7d3d173a3a345ef5bca43d9432733d1896aeef598266e40a57ea11e681
|
|
BLAKE2b-256 checksum How to use checksums |
54a22f790ebb3b38a2b863538cf5cb911d085e7cd6fd046cba344488aca12668
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for pddiktipy 2.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.