爬虫业务中,常用的工具集
Project description
kkbtools
Introduction
公司爬虫业务中,常用的工具集
Requirement
Python >= 3.6
Install
pip install kkbtools
Usage
安装后将需要用到的类导入即可,更多方法,请查看源码
from kkbtools import PandasPro, Tools, OssUpload
Example
from kkbtools import PandasPro, Tools, OssUpload
# 将 list[dict] 数据插入excel
PandasPro.insert_lists_dict_to_excel(lists=[{'a': 1, 'b': 2}, {'a': 3, 'b': 4}], table_name='test')
# 将mysql数据插入excel中,数据库连接信息,默认读取环境变量 ~/.bash_profile
PandasPro.mysql_to_execl('test')
# 获取一天前时间戳,默认00:0:0:00时刻
# 1649734882
print(Tools.get_off_days_timestamp(-1))
# 拆分可迭代对象
# [[1, 2], [3, 4], [5]]
print(Tools.cut([1, 2, 3, 4, 5], 2))
# 把文件上传到oss中,生成直链后,发送到钉钉群,并删除本地文件
OssUpload.send_file_and_remove_oss('test.xlsx', 'https://此处写钉钉群连接')
# 依次为文件路径,Webhook地址,需要发送的消息,钉钉安全设置自定义关键字
# 这种方式直接发送文件到群里,文件有效期2小时,不经过oss存储,发送完毕后,删除本地文件
OssUpload.send_file_and_remove_ding('test.xlsx', 'https://此处写钉钉群连接')
Help Document
kkbtools [-h] [--help]
# 待完善。。。
Thanks
wshuo
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kkbtools-0.1.5.tar.gz
(11.5 kB
view details)
Built Distribution
kkbtools-0.1.5-py3-none-any.whl
(12.3 kB
view details)
File details
Details for the file kkbtools-0.1.5.tar.gz
.
File metadata
- Download URL: kkbtools-0.1.5.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39ba6d53715e4ee33fb19849813743ad232f455fae4c6129d06e32360676c789 |
|
MD5 | 3bb139dd46b7c4d22c708c17d1987912 |
|
BLAKE2b-256 | 36469522ad59a77f486c41625450a13f95d148938b394a1e87f8883c03f1ece4 |
File details
Details for the file kkbtools-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: kkbtools-0.1.5-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b5424a303a1070bf1c055653928e1cdfe5cba93435accdcb6715739d7022f07 |
|
MD5 | 8f1fe0c56f851199aa4bc0cb84bafa62 |
|
BLAKE2b-256 | 4620821edcaf72680e2fa4d2271386a1c9796f6586f1f3c0e0113436fdb08e5a |