Initial commit

This commit is contained in:
Alex committed 2026-11-02 22:54:14 +08:00
commit 57fc3525eb
7311 files changed
+1291398

No files matched your search

@@ -0,0 +1 @@
pip
@@ -0,0 +1,97 @@
Metadata-Version: 2.4
Name: DrissionRecord
Version: 2.0.2
Summary: 用于记录数据的模块。
Home-page: https://gitcode.com/g1879/DrissionRecord
Author: g1879
Author-email: g1879@qq.com
License: MIT
Keywords: DrissionRecord
Classifier: Programming Language :: Python :: 3.6
Classifier: Development Status :: 4 - Beta
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: openpyxl
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary
# ⭐️ 简介
本库是一个基于 python 的工具集,用于记录数据到文件。
使用方便,代码简洁,是一个可靠、省心且实用的工具。
支持多线程同时写入文件。
**联系邮箱:** g1879@qq.com
**使用手册:** 📒[点击打开](https://DrissionPage.cn/DrissionRecord/)
# ✨️ 理念
简单,可靠,省心。
# 📕 背景
进行数据采集的时候,常常要保存数据到文件,频繁开关文件会影响效率,而如果等采集结束再写入,会有因异常而丢失数据的风险。
因此写了这个工具,只要把数据扔进去,它能缓存到一定数量再一次写入,减少文件开关次数,且在程序崩溃或退出时尽量自动保存。
它们使用非常方便,无论何时何地,无论什么格式,只要使用`add_data()`方法把数据存进去即可,语法极其简明扼要,使程序员能更专注业务逻辑。
它们还相当可靠,作者曾一次过连续记录超过 300 万条数据,也曾 50 个线程同时运行写入数万条数据到一个文件,依然轻松胜任。
工具还对表格文件(xlsx、csv)做了很多优化,封装了实用功能,可以使用表格文件方便地实现断点续爬、批量转移数据、指定坐标填写数据等。
# 🍀 特性
- 可以缓存数据到一定数量再一次写入,减少文件读写次数,降低开销。
- 支持多线程同时写入数据。
- 写入时如文件打开,会自动等待文件关闭再写入,避免数据丢失。
- 对断点续爬提供良好支持。
- 可方便地批量转移数据。
- 可根据字典数据自动创建表头。
- 自动创建文件和路径,减少代码量。
# 🌠 概览
本库核心工具是`Recorder`类。
支持 xlsx、csv、json、jsonl、sqlite、txt、byte 7 种类型文件。
使用逻辑:创建对象 -> 添加数据 -> 记录数据。
针对不同文件格式实现各种便捷功能。
可指定坐标写入数据,也可为 xlsx 设置单元格格式、图片和链接等。还支持自动匹配表头,文件数据读取等。
```python
from DrissionRecord import Recorder
data = ((1, 2, 3, 4),
(5, 6, 7, 8))
r = Recorder('data.csv')
r.add_data(data) # 一次记录多行数据
r.add_data('abc') # 记录单行数据
r.record()
```
# ☕ 请我喝咖啡
如果本项目对您有所帮助,不妨请作者我喝杯咖啡 :)
![](https://gitee.com/g1879/DrissionPageDocs/raw/master/static/img/code.jpg)
@@ -0,0 +1,52 @@
DrissionRecord/__init__.py,sha256=XXnG2ooee67QaucIFVb9wOdANFM-DZPqFV9uITNqnAM,356
DrissionRecord/__pycache__/__init__.cpython-314.pyc,,
DrissionRecord/__pycache__/cell_style.cpython-314.pyc,,
DrissionRecord/__pycache__/data.cpython-314.pyc,,
DrissionRecord/__pycache__/header.cpython-314.pyc,,
DrissionRecord/__pycache__/recorder.cpython-314.pyc,,
DrissionRecord/__pycache__/setter.cpython-314.pyc,,
DrissionRecord/__pycache__/tools.cpython-314.pyc,,
DrissionRecord/cell_style.py,sha256=8tmETEEd3-zKqRKl2TsIVheSRT4NRnt9BFqXxMwX_6s,20047
DrissionRecord/cell_style.pyi,sha256=f1aRdq76INd8eJYxvxhRe3UmCKiIjuOBTiU9ro4IX_k,23595
DrissionRecord/data.py,sha256=u9WCFaa3cd2-EOweV6EIoZG7-I8y6yFPyHT3ifHGfbM,1944
DrissionRecord/data.pyi,sha256=tQYjfIOenbgNdIOQCa-6ZtY-89JFZqvyzIGXOQjZlIg,2577
DrissionRecord/handlers/__init__.py,sha256=dhmpNrNd5la3t3oFP4t8YMclqR3UAH6eUDdOww_4Oag,24
DrissionRecord/handlers/__pycache__/__init__.cpython-314.pyc,,
DrissionRecord/handlers/__pycache__/base_handler.cpython-314.pyc,,
DrissionRecord/handlers/__pycache__/byte_handler.cpython-314.pyc,,
DrissionRecord/handlers/__pycache__/csv_handler.cpython-314.pyc,,
DrissionRecord/handlers/__pycache__/db_handler.cpython-314.pyc,,
DrissionRecord/handlers/__pycache__/json_handler.cpython-314.pyc,,
DrissionRecord/handlers/__pycache__/jsonl_handler.cpython-314.pyc,,
DrissionRecord/handlers/__pycache__/txt_handler.cpython-314.pyc,,
DrissionRecord/handlers/__pycache__/xlsx_handler.cpython-314.pyc,,
DrissionRecord/handlers/base_handler.py,sha256=woRsrENv6VjYu0xdlwqwtV7G5hytIoZx_XkKROfEACE,6909
DrissionRecord/handlers/base_handler.pyi,sha256=zyON0J8Y8XuRNFMcrQ2Iae2TzPQVkEg7_32XeRTgbJw,14081
DrissionRecord/handlers/byte_handler.py,sha256=kvcwNlpxqmydbq6JBLEoGxKE6wPxf47T2RJ6mIpOJ90,1213
DrissionRecord/handlers/csv_handler.py,sha256=5PIsna41FkwwcxzIr2CuGBrDzSsH8NSTZ-ETEl9wBjA,12617
DrissionRecord/handlers/csv_handler.pyi,sha256=O6yVcDBFk3XXG9IH-iJNomYOlhQ7_F-SaXQyl8PhI-E,4422
DrissionRecord/handlers/db_handler.py,sha256=1MRki4U5Qwx8V3tzgM0amM4kbbXLZKAzMWYOxjz7XHA,8185
DrissionRecord/handlers/db_handler.pyi,sha256=08AlKP3cvVYDObzFqpZNFNRxBBl6_WPvSd1C-9uuYiE,1272
DrissionRecord/handlers/json_handler.py,sha256=6DdfCH9t771CSksoWBVcxSP91FVtmhUM7Fhw4aSXoRY,4298
DrissionRecord/handlers/json_handler.pyi,sha256=qHZd5DLLZmFoL9IsZSjTAQugm-xFn0ioFumFAfpMzag,815
DrissionRecord/handlers/jsonl_handler.py,sha256=HbfuON5kxnFOT4wArBI6mguzBcul3ZNndmtSySGzN_Y,6631
DrissionRecord/handlers/jsonl_handler.pyi,sha256=BFGgKwgeJb_zrxgT_f-0PzJufawjN8JGA7kexUEdzrM,4454
DrissionRecord/handlers/txt_handler.py,sha256=FiODHCC3IwUdEqj1-EJb6iQVczGc0WvLzB4vSzFB_4s,2565
DrissionRecord/handlers/txt_handler.pyi,sha256=afjMOm3ii46W4Bj7gRu7I9jiFeOJ-Bub1NsZf6gP-hI,1265
DrissionRecord/handlers/xlsx_handler.py,sha256=erzxzKudKLNfIZzmomy29w9LFBOLVlSCyK-cSwt7RXM,30442
DrissionRecord/handlers/xlsx_handler.pyi,sha256=9KNFrQHlQBP2v1RpYzBepwfTbGSzdwIUGyOAWb1o_Sw,9425
DrissionRecord/header.py,sha256=mhJGlh_NJquShOKbjxsmw0t6gw06IcS8-lejh72yDRc,8979
DrissionRecord/header.pyi,sha256=DC174gcSLAcyXLTtkCRFIEDFssSzqrc0WrSQmfW625Q,5647
DrissionRecord/recorder.py,sha256=T4jwMU0gqVMr3dZBXaurmfB6t2XRmEprKejeUNPqGHg,6377
DrissionRecord/recorder.pyi,sha256=_nat27FQp5OdY5PVRoScOIMLZwpgxBqACnBS-o3bs1A,10767
DrissionRecord/setter.py,sha256=Nkx_gbo0_liu4DgPbtKYwbLhzu_b2-LXmJ-GlpJlbnY,2398
DrissionRecord/setter.pyi,sha256=8PWvbg2zkkNDDak1BxryWc-NjjmcIxdwNgQVolP2HG8,5938
DrissionRecord/tools.py,sha256=nwF7nwZOfUHtPipXmbb47P8le25lioUkEryMylT7YLM,5211
DrissionRecord/tools.pyi,sha256=KwW388PgIk5mNirA_ha_ZgHELRRWj2OIqudDzVVX0us,3577
drissionrecord-2.0.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
drissionrecord-2.0.2.dist-info/METADATA,sha256=lXOv9ccaGPgG1ggkvM4MqYGhyHHajqnP2CC_rwZ8KK0,3366
drissionrecord-2.0.2.dist-info/RECORD,,
drissionrecord-2.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
drissionrecord-2.0.2.dist-info/entry_points.txt,sha256=jjEmv3wH3hCH4-_5zAWmqNXQkTDUZ8tUdSWKHzFPza0,71
drissionrecord-2.0.2.dist-info/licenses/LICENSE,sha256=CkdeC3oUOYQzjzij5gbwjmnqozujUKOcwE8zfSzmsfQ,1083
drissionrecord-2.0.2.dist-info/top_level.txt,sha256=HQQJyCwoEXL5ScanzyDc14JraHwOmnkpIMtX3Mfh-zo,15
@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: setuptools (80.9.0)
Root-Is-Purelib: true
Tag: py3-none-any
@@ -0,0 +1,2 @@
[pyinstaller40]
hook-dirs = DrissionRecord.__pyinstaller:get_hook_dirs
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 g1879
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1 @@
DrissionRecord