muhiqsimui/pertaminyak

GitHub: muhiqsimui/pertaminyak

基于逆向工程 MyPertamina API 的非官方数据采集与应用工具集,提供桌面应用、CLI 脚本和 REST API 多种数据访问方式。

Stars: 0 | Forks: 0

# Pertaminyak ![FastAPI](https://img.shields.io/badge/FastAPI-005571.svg?style=for-the-badge&logo=fastapi) ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) **Pertaminyak** 是一份非官方的文档与应用,基于对 **MyPertamina API** 的爬取和逆向工程制作。 所有抓取的数据均为无需认证即可访问的公开数据。请合理使用,并添加适当的延迟(例如 0.2 秒),以免给服务器造成过重负担。" ## 📌 核心功能 - **Data Fetcher:** 自动抓取 Pertamina 的公开数据。 - **Client App Examples:** 提供使用 Python 调用 API 的实现示例,包含可直接使用的桌面应用、CLI 脚本以及 REST API。 - **API Documentation:** 提供通过爬取和逆向工程获得的公开 _endpoint_ 文档。 ## 🛠️ 使用指南 请确保使用 Python 3.12.4 或更高版本。 创建虚拟环境 ``` python -m venv myvenv ``` 激活虚拟环境 ``` .\myvenv\Scripts\activate ``` 安装所需的依赖项: ``` pip install -r requirements.txt ``` ## 开箱即用的应用功能 ### 1. 桌面应用 适用于 B2B 业务(尤其是物流领域)的桌面应用,用于查询 Pertamina 价格以及搜索 Pertamina 站点地址。 ``` python pertamina_desktop.py ``` ![Desktop APP](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/8d4548cd00221134.webp) ### 2. CLI 脚本 如果您不喜欢桌面界面,这里提供了 CLI 版本。 ``` python .\cli_script\pertamina.py python .\cli_script\pertamina_2.py python .\cli_script\pertamina_cache.py ``` ![CLI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/e5c223cf7a221140.webp) ### 3. 非官方 PERTAMINA API 如果您想构建后端来克隆 Pertamina API,可以使用此方案。该 API 的工作原理是每天一次从官方获取数据并存储在 cache 中,供您自己的服务器使用,从而不会增加官方服务器的负担。 ``` python rest_api_pertamina.py ``` 在开发环境下,可通过端口 8000 访问 `http://localhost:8000`,文档地址为 `http://localhost:8000/docs`。 ![CLI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/2368a0fee8221145.webp) 首次运行时,由于数据量较大,系统会先进行下载,因此不会立即显示数据,请耐心等待。在此之后,由于数据已存储在 cache 中,访问速度将非常快。 ### 4. 获取数据 该脚本会将发现的 Pertamina API 中的所有公开数据无一例外地抓取并保存为 CSV 和 JSON 文件,只需运行以下命令: ``` python .\fetch_data\fetch.py ``` ### 5. 非官方 Pertamina API 文档 - [非官方 MyPertamina 文档](MYPERTAMINA_DOC_UNOFFICIAL.md)(通过对 **_api.web.mypertamina.id_** 进行爬取和逆向工程获取,用于学习 Pertamina API 的工作原理) 如果这些工具、文档或应用对您的业务、研究或工作有所帮助,您可以通过给本仓库点赞或通过以下平台提供支持来表达感谢: 👉 **[通过 Saweria 支持本项目](https://saweria.co/muhiqsimui)** [![Saweria](https://img.shields.io/badge/Saweria-E4BA40?style=for-the-badge&logo=ko-fi&logoColor=white)](https://saweria.co/muhiqsimui)
标签:API文档, AV绕过, FastAPI, Python, URL抓取, 云资产清单, 数据抓取, 无后门, 逆向工具, 逆向工程