eric-tools 1.3.4__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. eric_tools-1.4.0/PKG-INFO +64 -0
  2. eric_tools-1.4.0/README.md +46 -0
  3. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/__init__.py +1 -1
  4. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/dynamic_settings.py +2 -28
  5. eric_tools-1.4.0/eric_tools.egg-info/PKG-INFO +64 -0
  6. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools.egg-info/SOURCES.txt +0 -5
  7. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools.egg-info/requires.txt +0 -1
  8. {eric_tools-1.3.4 → eric_tools-1.4.0}/setup.py +1 -2
  9. eric_tools-1.3.4/PKG-INFO +0 -73
  10. eric_tools-1.3.4/README.md +0 -55
  11. eric_tools-1.3.4/eric_tools/ip.py +0 -30
  12. eric_tools-1.3.4/eric_tools/nginx_log.py +0 -44
  13. eric_tools-1.3.4/eric_tools/remove.py +0 -47
  14. eric_tools-1.3.4/eric_tools/send_email.py +0 -31
  15. eric_tools-1.3.4/eric_tools/sftp.py +0 -17
  16. eric_tools-1.3.4/eric_tools.egg-info/PKG-INFO +0 -73
  17. {eric_tools-1.3.4 → eric_tools-1.4.0}/LICENSE +0 -0
  18. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/Abstract.py +0 -0
  19. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/async_queue.py +0 -0
  20. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/convert_json.py +0 -0
  21. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/decorator.py +0 -0
  22. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/delete_duplicate.py +0 -0
  23. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/downloader.py +0 -0
  24. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/encryption_classmethod.py +0 -0
  25. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/excel_generator.py +0 -0
  26. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/exception_class.py +0 -0
  27. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/jwt_encrypt.py +0 -0
  28. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/logMixin.py +0 -0
  29. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/logger.py +0 -0
  30. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/pgsql.py +0 -0
  31. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools/resize_image.py +0 -0
  32. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools.egg-info/dependency_links.txt +0 -0
  33. {eric_tools-1.3.4 → eric_tools-1.4.0}/eric_tools.egg-info/top_level.txt +0 -0
  34. {eric_tools-1.3.4 → eric_tools-1.4.0}/setup.cfg +0 -0
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.1
2
+ Name: eric_tools
3
+ Version: 1.4.0
4
+ Summary: Python Daily Development Tools
5
+ Home-page: https://github.com/Eric-jxl/Tools
6
+ Author: Eric
7
+ Author-email: jxleric95@gmail.com
8
+ License: UNKNOWN
9
+ Platform: UNKNOWN
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.0
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # Tools
18
+ [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)
19
+ ![latest 1.4.0](https://img.shields.io/badge/latest-1.4.0-green.svg?style=flat)
20
+ ![GitHub commits since latest release](https://img.shields.io/github/commits-since/eric-jxl/Tools/latest)
21
+ [![Publish Python Package](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml/badge.svg)](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml)
22
+
23
+
24
+ [Reids](https://eric-jxl.github.io/bak/index.html)
25
+
26
+ #### Project management of Python daily tools
27
+
28
+ ```shell
29
+ pip install eric_tools
30
+ ```
31
+
32
+
33
+
34
+ | 文件名 | 说明 |
35
+ | :----------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------: |
36
+ | [exception_class.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/encryption_classmethod.py) | 异常类 |
37
+ | [resize_image.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/resize_image.py) | 图片压缩 |
38
+ | [logger.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/logger.py) | 日志模块类和高级日志装饰器 |
39
+ | [pgsql.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/pgsql.py) | postgresql CRUD |
40
+ | [jwt_encrypt.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/jwt_encrypt.py) | 生成jwt Access Token 加密及解密 |
41
+ | [convert_json.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/convert_json.py) | 支持json和object之间转换 |
42
+ | [Abstract.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/Abstract.py) | 抽象类模型 |
43
+ | [decorator.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/decorator.py) | 惰性属性装饰器 |
44
+ | [async_queue.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/async_queue.py) | 异步队列 |
45
+ | [downloader.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/downloader.py) | 下载器 |
46
+ | [logMixin.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/logMixin.py) | 日志元类和高级日志装饰器 |
47
+
48
+
49
+
50
+
51
+
52
+ >[!TIP]
53
+ >
54
+ > * async_queue.py 异步队列操作
55
+ >
56
+ > * downloader.py 下载器
57
+ >
58
+ > * logMixIn.py 日志元类和高级日志装饰器
59
+ > >
60
+ > * dynamic_settings 一个动态加载配置类(支持toml、yml、conf、csv、ini等)
61
+ >
62
+ > * delete_duplicate 删除工作区重复文件(包括图片等)
63
+
64
+
@@ -0,0 +1,46 @@
1
+ # Tools
2
+ [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)
3
+ ![latest 1.4.0](https://img.shields.io/badge/latest-1.4.0-green.svg?style=flat)
4
+ ![GitHub commits since latest release](https://img.shields.io/github/commits-since/eric-jxl/Tools/latest)
5
+ [![Publish Python Package](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml/badge.svg)](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml)
6
+
7
+
8
+ [Reids](https://eric-jxl.github.io/bak/index.html)
9
+
10
+ #### Project management of Python daily tools
11
+
12
+ ```shell
13
+ pip install eric_tools
14
+ ```
15
+
16
+
17
+
18
+ | 文件名 | 说明 |
19
+ | :----------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------: |
20
+ | [exception_class.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/encryption_classmethod.py) | 异常类 |
21
+ | [resize_image.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/resize_image.py) | 图片压缩 |
22
+ | [logger.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/logger.py) | 日志模块类和高级日志装饰器 |
23
+ | [pgsql.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/pgsql.py) | postgresql CRUD |
24
+ | [jwt_encrypt.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/jwt_encrypt.py) | 生成jwt Access Token 加密及解密 |
25
+ | [convert_json.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/convert_json.py) | 支持json和object之间转换 |
26
+ | [Abstract.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/Abstract.py) | 抽象类模型 |
27
+ | [decorator.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/decorator.py) | 惰性属性装饰器 |
28
+ | [async_queue.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/async_queue.py) | 异步队列 |
29
+ | [downloader.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/downloader.py) | 下载器 |
30
+ | [logMixin.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/logMixin.py) | 日志元类和高级日志装饰器 |
31
+
32
+
33
+
34
+
35
+
36
+ >[!TIP]
37
+ >
38
+ > * async_queue.py 异步队列操作
39
+ >
40
+ > * downloader.py 下载器
41
+ >
42
+ > * logMixIn.py 日志元类和高级日志装饰器
43
+ > >
44
+ > * dynamic_settings 一个动态加载配置类(支持toml、yml、conf、csv、ini等)
45
+ >
46
+ > * delete_duplicate 删除工作区重复文件(包括图片等)
@@ -11,7 +11,7 @@ from .dynamic_settings import DynamicConfig
11
11
  name = 'Eric-Tools'
12
12
  __title__ = 'tools'
13
13
  __description__ = 'Python HTTP for Humans.'
14
- __version__ = "1.3.4"
14
+ __version__ = "1.4.0"
15
15
  __author__ = 'Eric'
16
16
  __doc__ = ["Python Daily Development Tools"]
17
17
  __url__ = "https://github.com/Eric-jxl/Tools"
@@ -7,15 +7,12 @@ import logging
7
7
  from collections.abc import MutableMapping
8
8
  from watchdog.observers import Observer
9
9
  from watchdog.events import FileSystemEventHandler
10
- from flask import Flask, jsonify, redirect
11
10
 
12
11
  logging.basicConfig(level=logging.INFO)
13
12
  logger = logging.getLogger(__file__.rsplit("/", 1)[1])
14
13
 
15
14
  __all__ = ["DynamicConfig"]
16
15
 
17
- # Flask Web Service for testing
18
- app = Flask(__name__)
19
16
 
20
17
 
21
18
  class ConfigFileHandler(FileSystemEventHandler):
@@ -144,29 +141,6 @@ class DynamicConfig(MutableMapping):
144
141
  self._observer.stop()
145
142
  self._observer.join()
146
143
 
147
-
148
- @app.route("/", methods=["GET"])
149
- def index():
150
- return redirect("/config/")
151
-
152
-
153
- @app.route("/config/", methods=["GET"])
154
- def get_config():
155
- config = DynamicConfig("config.yml", debug=True, mode="production")
156
- config.force_reload()
157
- return jsonify(config.config)
158
-
159
-
160
- @app.route("/config/<path:key>", methods=["GET"]) # ✅ 允许 `/` 作为 key 的一部分
161
- def get_config_key(key):
162
- """获取指定配置项的值,并支持自动重新加载"""
163
- config = DynamicConfig("config.yml", debug=True, mode="production")
164
- config.force_reload() # ✅ 先重新加载配置
165
- value = config.get(key) # ✅ 取值
166
- if value is None:
167
- return jsonify({"error": "Key not found"}), 404 # ✅ 404 + 友好错误信息
168
- return jsonify(value)
169
-
170
-
171
144
  if __name__ == "__main__":
172
- app.run(host="0.0.0.0", port=5001, debug=True)
145
+ config = DynamicConfig(watch_file="config.yml")
146
+ print(config.get("development.password"))
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.1
2
+ Name: eric-tools
3
+ Version: 1.4.0
4
+ Summary: Python Daily Development Tools
5
+ Home-page: https://github.com/Eric-jxl/Tools
6
+ Author: Eric
7
+ Author-email: jxleric95@gmail.com
8
+ License: UNKNOWN
9
+ Platform: UNKNOWN
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.0
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # Tools
18
+ [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)
19
+ ![latest 1.4.0](https://img.shields.io/badge/latest-1.4.0-green.svg?style=flat)
20
+ ![GitHub commits since latest release](https://img.shields.io/github/commits-since/eric-jxl/Tools/latest)
21
+ [![Publish Python Package](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml/badge.svg)](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml)
22
+
23
+
24
+ [Reids](https://eric-jxl.github.io/bak/index.html)
25
+
26
+ #### Project management of Python daily tools
27
+
28
+ ```shell
29
+ pip install eric_tools
30
+ ```
31
+
32
+
33
+
34
+ | 文件名 | 说明 |
35
+ | :----------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------: |
36
+ | [exception_class.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/encryption_classmethod.py) | 异常类 |
37
+ | [resize_image.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/resize_image.py) | 图片压缩 |
38
+ | [logger.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/logger.py) | 日志模块类和高级日志装饰器 |
39
+ | [pgsql.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/pgsql.py) | postgresql CRUD |
40
+ | [jwt_encrypt.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/jwt_encrypt.py) | 生成jwt Access Token 加密及解密 |
41
+ | [convert_json.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/convert_json.py) | 支持json和object之间转换 |
42
+ | [Abstract.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/Abstract.py) | 抽象类模型 |
43
+ | [decorator.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/decorator.py) | 惰性属性装饰器 |
44
+ | [async_queue.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/async_queue.py) | 异步队列 |
45
+ | [downloader.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/downloader.py) | 下载器 |
46
+ | [logMixin.py](https://github.com/eric-jxl/Tools/blob/main/eric_tools/logMixin.py) | 日志元类和高级日志装饰器 |
47
+
48
+
49
+
50
+
51
+
52
+ >[!TIP]
53
+ >
54
+ > * async_queue.py 异步队列操作
55
+ >
56
+ > * downloader.py 下载器
57
+ >
58
+ > * logMixIn.py 日志元类和高级日志装饰器
59
+ > >
60
+ > * dynamic_settings 一个动态加载配置类(支持toml、yml、conf、csv、ini等)
61
+ >
62
+ > * delete_duplicate 删除工作区重复文件(包括图片等)
63
+
64
+
@@ -12,16 +12,11 @@ eric_tools/dynamic_settings.py
12
12
  eric_tools/encryption_classmethod.py
13
13
  eric_tools/excel_generator.py
14
14
  eric_tools/exception_class.py
15
- eric_tools/ip.py
16
15
  eric_tools/jwt_encrypt.py
17
16
  eric_tools/logMixin.py
18
17
  eric_tools/logger.py
19
- eric_tools/nginx_log.py
20
18
  eric_tools/pgsql.py
21
- eric_tools/remove.py
22
19
  eric_tools/resize_image.py
23
- eric_tools/send_email.py
24
- eric_tools/sftp.py
25
20
  eric_tools.egg-info/PKG-INFO
26
21
  eric_tools.egg-info/SOURCES.txt
27
22
  eric_tools.egg-info/dependency_links.txt
@@ -1,6 +1,5 @@
1
1
  psycopg2
2
2
  requests
3
- paramiko
4
3
  Pillow
5
4
  xlsxwriter
6
5
  ImageHash
@@ -7,7 +7,7 @@ with open("README.md", "r") as fh:
7
7
 
8
8
  setuptools.setup(
9
9
  name="eric_tools",
10
- version="1.3.4",
10
+ version="1.4.0",
11
11
  author="Eric",
12
12
  author_email="jxleric95@gmail.com",
13
13
  description="Python Daily Development Tools",
@@ -25,7 +25,6 @@ setuptools.setup(
25
25
  install_requires=[
26
26
  'psycopg2',
27
27
  'requests',
28
- 'paramiko',
29
28
  'Pillow',
30
29
  'xlsxwriter',
31
30
  "ImageHash",
eric_tools-1.3.4/PKG-INFO DELETED
@@ -1,73 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: eric_tools
3
- Version: 1.3.4
4
- Summary: Python Daily Development Tools
5
- Home-page: https://github.com/Eric-jxl/Tools
6
- Author: Eric
7
- Author-email: jxleric95@gmail.com
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.0
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
-
17
- # Tools
18
- [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)
19
- ![latest 1.3.4](https://img.shields.io/badge/latest-1.3.4-green.svg?style=flat)
20
- ![GitHub commits since latest release](https://img.shields.io/github/commits-since/eric-jxl/Tools/latest)
21
- [![Publish Python Package](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml/badge.svg)](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml)
22
-
23
-
24
- [Reids](https://eric-jxl.github.io/bak/index.html)
25
-
26
- #### Project management of Python daily tools
27
-
28
- ```shell
29
- pip install eric_tools
30
- ```
31
-
32
-
33
-
34
- | 文件名 | 说明 |
35
- | :----------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------: |
36
- | [encryption_classmethod.py ](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/Abstract.py) | HMAC+MD5加密签名算法 |
37
- | [exception_class.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/exception_class.py) | 异常类 |
38
- | [resize_image.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/resize_image.py) | 图片压缩 |
39
- | [ip.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/ip.py) | ip地址定位API |
40
- | [logger.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/logger.py) | 日志模块类和高级日志装饰器 |
41
- | [remove.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/remove.py) | 删除文件 |
42
- | [send_email.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/send_email.py) | 发送邮件 |
43
- | [sftp.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/sftp.py) | ssh远程下载文件 |
44
- | [pgsql.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/pgsql.py) | postgresql CRUD |
45
- | [readconfig.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/readconfig.py) | 读取.ini配置文件 |
46
- | [jwt_encrypt.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/jwt_encrypt.py) | 生成jwt Access Token 加密及解密 |
47
- | [convert_json.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/convert_json.py) | 支持json和object之间转换 |
48
- | [Abstract.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/Abstract.py) | 抽象类模型 |
49
- | [decorator.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/decorator.py) | 惰性属性装饰器 |
50
- | [async_queue.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/async_queue.py) | 异步队列 |
51
- | [downloader.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/downloader.py) | 下载器 |
52
- | [logMixin.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/logMixin.py) | 日志元类和高级日志装饰器 |
53
- | [nginx_log.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/nginx_log.py) | nginx日志解析(默认access.log) |
54
-
55
-
56
-
57
-
58
-
59
- >[!TIP]
60
- >
61
- > * async_queue.py 异步队列操作
62
- >
63
- > * downloader.py 下载器
64
- >
65
- > * logMixIn.py 日志元类和高级日志装饰器
66
- >
67
- > * nginx_log.py nginx日志解析(默认access.log)
68
- >
69
- > * dynamic_settings 一个动态加载配置类(支持toml、yml、conf、csv、ini等)
70
- >
71
- > * delete_duplicate 删除工作区重复文件(包括图片等)
72
-
73
-
@@ -1,55 +0,0 @@
1
- # Tools
2
- [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)
3
- ![latest 1.3.4](https://img.shields.io/badge/latest-1.3.4-green.svg?style=flat)
4
- ![GitHub commits since latest release](https://img.shields.io/github/commits-since/eric-jxl/Tools/latest)
5
- [![Publish Python Package](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml/badge.svg)](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml)
6
-
7
-
8
- [Reids](https://eric-jxl.github.io/bak/index.html)
9
-
10
- #### Project management of Python daily tools
11
-
12
- ```shell
13
- pip install eric_tools
14
- ```
15
-
16
-
17
-
18
- | 文件名 | 说明 |
19
- | :----------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------: |
20
- | [encryption_classmethod.py ](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/Abstract.py) | HMAC+MD5加密签名算法 |
21
- | [exception_class.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/exception_class.py) | 异常类 |
22
- | [resize_image.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/resize_image.py) | 图片压缩 |
23
- | [ip.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/ip.py) | ip地址定位API |
24
- | [logger.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/logger.py) | 日志模块类和高级日志装饰器 |
25
- | [remove.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/remove.py) | 删除文件 |
26
- | [send_email.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/send_email.py) | 发送邮件 |
27
- | [sftp.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/sftp.py) | ssh远程下载文件 |
28
- | [pgsql.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/pgsql.py) | postgresql CRUD |
29
- | [readconfig.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/readconfig.py) | 读取.ini配置文件 |
30
- | [jwt_encrypt.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/jwt_encrypt.py) | 生成jwt Access Token 加密及解密 |
31
- | [convert_json.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/convert_json.py) | 支持json和object之间转换 |
32
- | [Abstract.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/Abstract.py) | 抽象类模型 |
33
- | [decorator.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/decorator.py) | 惰性属性装饰器 |
34
- | [async_queue.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/async_queue.py) | 异步队列 |
35
- | [downloader.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/downloader.py) | 下载器 |
36
- | [logMixin.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/logMixin.py) | 日志元类和高级日志装饰器 |
37
- | [nginx_log.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/nginx_log.py) | nginx日志解析(默认access.log) |
38
-
39
-
40
-
41
-
42
-
43
- >[!TIP]
44
- >
45
- > * async_queue.py 异步队列操作
46
- >
47
- > * downloader.py 下载器
48
- >
49
- > * logMixIn.py 日志元类和高级日志装饰器
50
- >
51
- > * nginx_log.py nginx日志解析(默认access.log)
52
- >
53
- > * dynamic_settings 一个动态加载配置类(支持toml、yml、conf、csv、ini等)
54
- >
55
- > * delete_duplicate 删除工作区重复文件(包括图片等)
@@ -1,30 +0,0 @@
1
- # -*- coding:utf-8 -*-
2
- '''
3
- @Author : Eric
4
- @Time : 2020-09-15 17:20
5
- @IDE : PyCharm
6
- '''
7
-
8
- import requests
9
-
10
-
11
- def ip_search(ip=None):
12
- assert not isinstance(ip, (int, float)), 'ip类型不能为数值'
13
- if ip is not None:
14
- if isinstance(ip, (list, set)):
15
- for i in ip:
16
- url = 'http://ip-api.com/json/' + i + '?lang=zh-CN'
17
- response = requests.post(url)
18
- print(response.json())
19
-
20
- elif isinstance(ip, str):
21
- url = 'http://ip-api.com/json/' + ip + '?lang=zh-CN'
22
- response = requests.post(url)
23
- res = response.json()
24
- print(str({'国家': res['country'], '省/直辖市': res['regionName'], '城市': res['city'],
25
- '运营商': res['isp']}))
26
-
27
- else:
28
- url = 'http://ip-api.com/json/?lang=zh-CN'
29
- response = requests.post(url)
30
- print(response.content)
@@ -1,44 +0,0 @@
1
- import sys
2
- import os
3
- import datetime
4
-
5
- # 定义一个函数来获取用户的输入
6
-
7
-
8
- def get_user_input(prompt):
9
- return input(prompt)
10
-
11
-
12
- # 获取当前日期
13
- today = datetime.date.today()
14
-
15
- # 获取过去三天的日期
16
- three_days_ago = today - datetime.timedelta(days=3)
17
-
18
- # 获取要切割的日志文件路径
19
- log_file_path = '/var/log/nginx/access.log'
20
-
21
- # 获取要匹配的IP地址
22
- ip_address = get_user_input("Enter the IP address to match: ")
23
-
24
- # 创建一个新文件来存储切割后的日志
25
- output_file_path = 'nginx_access_log_cut.txt'
26
- with open(output_file_path, 'w') as output_file:
27
- # 逐行读取日志文件
28
- with open(log_file_path, 'r') as log_file:
29
- for line in log_file:
30
- # 分割日志行
31
- parts = line.split()
32
-
33
- # 获取日志日期
34
- log_date = parts[3][1:]
35
-
36
- # 检查日志日期是否在过去三天内
37
- if log_date >= three_days_ago.strftime('%d/%b/%Y'):
38
- # 检查日志行是否包含匹配的IP地址
39
- if ip_address in line:
40
- # 将日志行写入输出文件
41
- output_file.write(line)
42
-
43
- # 打印切割后的日志文件路径
44
- print(f"Cut nginx access log saved to: {output_file_path}")
@@ -1,47 +0,0 @@
1
- # -*- coding:utf-8 -*-
2
- '''
3
- @Author : Eric
4
- @Time : 2020-09-10 10:37
5
- @IDE : PyCharm
6
- '''
7
-
8
- import os
9
- import time
10
- import datetime
11
-
12
-
13
- class RemoveFile(object):
14
- def __init__(self, filename, timedifference):
15
- self.filename = filename
16
- self.timedifference = timedifference
17
-
18
- @staticmethod
19
- def fileremove(filename, timedifference):
20
-
21
- date = datetime.datetime.fromtimestamp(os.path.getmtime(filename))
22
- now = datetime.datetime.now()
23
-
24
- if (now - date).seconds > timedifference:
25
- if os.path.exists(filename):
26
- os.remove(filename)
27
- print('remove file: %s' % filename)
28
- else:
29
- print('no such file: %s' % filename)
30
-
31
-
32
- FILE_DIR = '/home'
33
-
34
- if __name__ == '__main__':
35
-
36
- while True:
37
- ITEMS = os.listdir(FILE_DIR)
38
- NEWLIST = []
39
- for names in ITEMS:
40
- if names.endswith(".txt"):
41
- NEWLIST.append(FILE_DIR + names)
42
-
43
- for names in NEWLIST:
44
- print('current file: %s' % (names))
45
- RemoveFile.fileremove(names, 10)
46
-
47
- time.sleep(2)
@@ -1,31 +0,0 @@
1
- # -*- coding:utf-8 -*-
2
- '''
3
- @Author : Eric
4
- @Time : 2021-01-15 13:50
5
- @IDE : PyCharm
6
- '''
7
-
8
- __doc__ = ["测试QQ邮箱,pwd为邮箱授权码"]
9
-
10
- import smtplib
11
- from email.mime.text import MIMEText
12
- from email.utils import formataddr
13
-
14
-
15
- def mail(send_email, receive_email, send_nickname, receive_nickname, pwd):
16
- try:
17
- msg = MIMEText('Test QQ Email', 'plain', 'utf-8')
18
- # 括号里的对应发件人邮箱昵称、发件人邮箱账号
19
- msg['From'] = formataddr([send_nickname, send_email])
20
- # 括号里的对应收件人邮箱昵称、收件人邮箱账号
21
- msg['To'] = formataddr([receive_nickname, receive_email])
22
- msg['Subject'] = "发送邮件测试" # 邮件的主题,也可以说是标题
23
-
24
- server = smtplib.SMTP_SSL("smtp.qq.com", 465) # 发件人邮箱中的SMTP服务器,端口是25
25
- server.login(send_email, pwd)
26
- # 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件
27
- server.sendmail(send_email, [receive_email, ], msg.as_string())
28
- server.quit() # 关闭连接
29
- except Exception as e:
30
- print('发送邮件失败:%s' % e)
31
- return e
@@ -1,17 +0,0 @@
1
- # -*- coding:utf-8 -*-
2
- '''
3
- @Author : Eric
4
- @Time : 2020-11-30 15:06
5
- @IDE : PyCharm
6
- '''
7
- import paramiko
8
-
9
-
10
- def remote_scp(host_ip, remote_path, local_path, username, password=None):
11
- t = paramiko.Transport(host_ip)
12
- t.connect(username=username, password=password) # 登录远程服务器
13
- sftp = paramiko.SFTPClient.from_transport(t) # sftp传输协议
14
- sftp.get(remote_path, local_path)
15
- t.close()
16
-
17
-
@@ -1,73 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: eric-tools
3
- Version: 1.3.4
4
- Summary: Python Daily Development Tools
5
- Home-page: https://github.com/Eric-jxl/Tools
6
- Author: Eric
7
- Author-email: jxleric95@gmail.com
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.0
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
-
17
- # Tools
18
- [![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)
19
- ![latest 1.3.4](https://img.shields.io/badge/latest-1.3.4-green.svg?style=flat)
20
- ![GitHub commits since latest release](https://img.shields.io/github/commits-since/eric-jxl/Tools/latest)
21
- [![Publish Python Package](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml/badge.svg)](https://github.com/eric-jxl/Tools/actions/workflows/publish-pypi.yml)
22
-
23
-
24
- [Reids](https://eric-jxl.github.io/bak/index.html)
25
-
26
- #### Project management of Python daily tools
27
-
28
- ```shell
29
- pip install eric_tools
30
- ```
31
-
32
-
33
-
34
- | 文件名 | 说明 |
35
- | :----------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------: |
36
- | [encryption_classmethod.py ](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/Abstract.py) | HMAC+MD5加密签名算法 |
37
- | [exception_class.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/exception_class.py) | 异常类 |
38
- | [resize_image.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/resize_image.py) | 图片压缩 |
39
- | [ip.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/ip.py) | ip地址定位API |
40
- | [logger.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/logger.py) | 日志模块类和高级日志装饰器 |
41
- | [remove.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/remove.py) | 删除文件 |
42
- | [send_email.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/send_email.py) | 发送邮件 |
43
- | [sftp.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/sftp.py) | ssh远程下载文件 |
44
- | [pgsql.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/pgsql.py) | postgresql CRUD |
45
- | [readconfig.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/readconfig.py) | 读取.ini配置文件 |
46
- | [jwt_encrypt.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/jwt_encrypt.py) | 生成jwt Access Token 加密及解密 |
47
- | [convert_json.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/convert_json.py) | 支持json和object之间转换 |
48
- | [Abstract.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/Abstract.py) | 抽象类模型 |
49
- | [decorator.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/decorator.py) | 惰性属性装饰器 |
50
- | [async_queue.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/async_queue.py) | 异步队列 |
51
- | [downloader.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/downloader.py) | 下载器 |
52
- | [logMixin.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/logMixin.py) | 日志元类和高级日志装饰器 |
53
- | [nginx_log.py](https://github.com/eric-jxl/Tools/blob/62f538a1d34df869722c68e3ea5df222bdd1605e/eric_tools/nginx_log.py) | nginx日志解析(默认access.log) |
54
-
55
-
56
-
57
-
58
-
59
- >[!TIP]
60
- >
61
- > * async_queue.py 异步队列操作
62
- >
63
- > * downloader.py 下载器
64
- >
65
- > * logMixIn.py 日志元类和高级日志装饰器
66
- >
67
- > * nginx_log.py nginx日志解析(默认access.log)
68
- >
69
- > * dynamic_settings 一个动态加载配置类(支持toml、yml、conf、csv、ini等)
70
- >
71
- > * delete_duplicate 删除工作区重复文件(包括图片等)
72
-
73
-
File without changes
File without changes