eric-tools 1.2.5__py3-none-any.whl
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.
- eric_tools/Abstract.py +50 -0
- eric_tools/__init__.py +28 -0
- eric_tools/convert_json.py +27 -0
- eric_tools/decorator.py +70 -0
- eric_tools/encryption_classmethod.py +55 -0
- eric_tools/exception_class.py +33 -0
- eric_tools/ip.py +30 -0
- eric_tools/jwt_encrypt.py +40 -0
- eric_tools/logger.py +69 -0
- eric_tools/pgsql.py +94 -0
- eric_tools/readconfig.py +30 -0
- eric_tools/remove.py +50 -0
- eric_tools/resize_image.py +86 -0
- eric_tools/send_email.py +35 -0
- eric_tools/sftp.py +17 -0
- eric_tools-1.2.5.dist-info/LICENSE +201 -0
- eric_tools-1.2.5.dist-info/METADATA +65 -0
- eric_tools-1.2.5.dist-info/RECORD +20 -0
- eric_tools-1.2.5.dist-info/WHEEL +5 -0
- eric_tools-1.2.5.dist-info/top_level.txt +1 -0
eric_tools/Abstract.py
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2021-06-15 15:35
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
import json
|
8
|
+
import sys
|
9
|
+
|
10
|
+
|
11
|
+
class AbstractModel(object):
|
12
|
+
"""Base class for all models."""
|
13
|
+
|
14
|
+
def _serialize(self, allow_none=False):
|
15
|
+
d = vars(self)
|
16
|
+
ret = {}
|
17
|
+
for k in d:
|
18
|
+
if isinstance(d[k], AbstractModel):
|
19
|
+
r = d[k]._serialize(allow_none)
|
20
|
+
elif isinstance(d[k], list):
|
21
|
+
r = list()
|
22
|
+
for tem in d[k]:
|
23
|
+
if isinstance(tem, AbstractModel):
|
24
|
+
r.append(tem._serialize(allow_none))
|
25
|
+
else:
|
26
|
+
r.append(
|
27
|
+
tem.encode("UTF-8") if isinstance(tem, type(u"")) and sys.version_info[0] == 2 else tem)
|
28
|
+
else:
|
29
|
+
r = d[k].encode("UTF-8") if isinstance(d[k], type(u"")) and sys.version_info[0] == 2 else d[k]
|
30
|
+
if allow_none or r is not None:
|
31
|
+
ret[k[0].upper() + k[1:]] = r
|
32
|
+
return ret
|
33
|
+
|
34
|
+
|
35
|
+
def _deserialize(self, params):
|
36
|
+
return None
|
37
|
+
|
38
|
+
def to_json_string(self, *args, **kwargs):
|
39
|
+
"""Serialize obj to a JSON formatted str, ensure_ascii is False by default"""
|
40
|
+
if "ensure_ascii" not in kwargs:
|
41
|
+
kwargs["ensure_ascii"] = False
|
42
|
+
return json.dumps(self._serialize(allow_none=True), *args, **kwargs)
|
43
|
+
|
44
|
+
def from_json_string(self, jsonStr):
|
45
|
+
"""Deserialize a JSON formatted str to a Python object"""
|
46
|
+
params = json.loads(jsonStr)
|
47
|
+
self._deserialize(params)
|
48
|
+
|
49
|
+
def __repr__(self):
|
50
|
+
return "%s" % self.to_json_string()
|
eric_tools/__init__.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2020-11-30 17:31
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
import decorator
|
8
|
+
import Abstract
|
9
|
+
import convert_json
|
10
|
+
import jwt_encrypt
|
11
|
+
import send_email
|
12
|
+
import readconfig
|
13
|
+
import sftp
|
14
|
+
import pgsql
|
15
|
+
import encryption_classmethod
|
16
|
+
import ip
|
17
|
+
import logger
|
18
|
+
import resize_image
|
19
|
+
import exception_class
|
20
|
+
|
21
|
+
name = 'Eric-Tools'
|
22
|
+
__title__ = 'tools'
|
23
|
+
__description__ = 'Python HTTP for Humans.'
|
24
|
+
__version__ = "1.2.5"
|
25
|
+
__author__ = 'Eric'
|
26
|
+
__doc__ = ["Python Daily Development Tools"]
|
27
|
+
__url__ = "https://github.com/Eric-jxl/Tools"
|
28
|
+
__license__ = "Apache"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2021-04-12 09:16
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
|
8
|
+
|
9
|
+
def obj_convert_dict(obj):
|
10
|
+
d = {}
|
11
|
+
d['__class__'] = obj.__class__.__name__
|
12
|
+
d['__module__'] = obj.__module__
|
13
|
+
d.update(obj.__dict__)
|
14
|
+
return d
|
15
|
+
|
16
|
+
|
17
|
+
def dict_convert_obj(d):
|
18
|
+
if '__class__' in d:
|
19
|
+
class_name = d.pop('__class__')
|
20
|
+
module_name = d.pop('__module__')
|
21
|
+
module = __import__(module_name)
|
22
|
+
class_ = getattr(module, class_name)
|
23
|
+
args = dict((key.encode('ascii'), value) for key, value in d.items())
|
24
|
+
instance = class_(**args)
|
25
|
+
else:
|
26
|
+
instance = d
|
27
|
+
return instance
|
eric_tools/decorator.py
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2021-08-02 09:50
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
import sys
|
8
|
+
from functools import wraps
|
9
|
+
|
10
|
+
|
11
|
+
class lazy_property(object):
|
12
|
+
"""
|
13
|
+
Decorator for a lazy property of an object, i.e., an object attribute
|
14
|
+
that is determined by the result of a method call evaluated once. To
|
15
|
+
reevaluate the property, simply delete the attribute on the object, and
|
16
|
+
get it again.
|
17
|
+
"""
|
18
|
+
def __init__(self, fget):
|
19
|
+
self.fget = fget
|
20
|
+
|
21
|
+
def __get__(self, obj, cls):
|
22
|
+
if obj is None:
|
23
|
+
return self
|
24
|
+
value = self.fget(obj)
|
25
|
+
setattr(obj, self.fget.__name__, value)
|
26
|
+
return value
|
27
|
+
|
28
|
+
@property
|
29
|
+
def __doc__(self):
|
30
|
+
return self.fget.__doc__
|
31
|
+
|
32
|
+
@staticmethod
|
33
|
+
def reset_all(obj):
|
34
|
+
""" Reset all lazy properties on the instance `obj`. """
|
35
|
+
cls = type(obj)
|
36
|
+
obj_dict = vars(obj)
|
37
|
+
for name in obj_dict.keys():
|
38
|
+
if isinstance(getattr(cls, name, None), lazy_property):
|
39
|
+
obj_dict.pop(name)
|
40
|
+
|
41
|
+
def synchronized(lock_attr='_lock'):
|
42
|
+
'''
|
43
|
+
:param lock_attr: sync lock
|
44
|
+
'''
|
45
|
+
def decorator(func):
|
46
|
+
@wraps(func)
|
47
|
+
def wrapper(self, *args, **kwargs):
|
48
|
+
lock = getattr(self, lock_attr)
|
49
|
+
try:
|
50
|
+
lock.acquire()
|
51
|
+
return func(self, *args, **kwargs)
|
52
|
+
finally:
|
53
|
+
lock.release()
|
54
|
+
return wrapper
|
55
|
+
return decorator
|
56
|
+
|
57
|
+
|
58
|
+
def alias(*aliases):
|
59
|
+
"""
|
60
|
+
Decorating a class with @alias('FOO', 'BAR', ..) allows the class to
|
61
|
+
be referenced by each of the names provided as arguments.
|
62
|
+
"""
|
63
|
+
def decorator(cls):
|
64
|
+
# alias must be set in globals from caller's frame
|
65
|
+
caller = sys._getframe(1)
|
66
|
+
globals_dict = caller.f_globals
|
67
|
+
for alias in aliases:
|
68
|
+
globals_dict[alias] = cls
|
69
|
+
return cls
|
70
|
+
return decorator
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2021-01-20 13:58
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
import binascii
|
8
|
+
import hashlib
|
9
|
+
import hmac
|
10
|
+
import sys
|
11
|
+
from exception_class import SelfException
|
12
|
+
|
13
|
+
__doc__ = "HMAC256 及SHA256混合加密"
|
14
|
+
__version__ ='1.0.0'
|
15
|
+
__all__ =['Sign']
|
16
|
+
__author__ = 'Eric'
|
17
|
+
|
18
|
+
class Sign(object):
|
19
|
+
|
20
|
+
@staticmethod
|
21
|
+
def sign(secretKey, signStr, signMethod):
|
22
|
+
if sys.version_info[0] > 2:
|
23
|
+
signStr = bytes(signStr, 'utf-8')
|
24
|
+
secretKey = bytes(secretKey, 'utf-8')
|
25
|
+
|
26
|
+
digestmod = None
|
27
|
+
if signMethod == 'HmacSHA256':
|
28
|
+
digestmod = hashlib.sha256
|
29
|
+
elif signMethod == 'HmacSHA1':
|
30
|
+
digestmod = hashlib.sha1
|
31
|
+
else:
|
32
|
+
raise SelfException("signMethod invalid", "signMethod only support (HmacSHA1, HmacSHA256)")
|
33
|
+
|
34
|
+
hashed = hmac.new(secretKey, signStr, digestmod)
|
35
|
+
base64 = binascii.b2a_base64(hashed.digest())[:-1]
|
36
|
+
|
37
|
+
if sys.version_info[0] > 2:
|
38
|
+
base64 = base64.decode()
|
39
|
+
|
40
|
+
return base64
|
41
|
+
|
42
|
+
@staticmethod
|
43
|
+
def sign_tc3(secret_key, date, service, str2sign):
|
44
|
+
def _hmac_sha256(key, msg):
|
45
|
+
return hmac.new(key, msg.encode('utf-8'), hashlib.sha256)
|
46
|
+
|
47
|
+
def _get_signature_key(key, date, service):
|
48
|
+
k_date = _hmac_sha256(('TC3' + key).encode('utf-8'), date)
|
49
|
+
k_service = _hmac_sha256(k_date.digest(), service)
|
50
|
+
k_signing = _hmac_sha256(k_service.digest(), 'tc3_request')
|
51
|
+
return k_signing.digest()
|
52
|
+
|
53
|
+
signing_key = _get_signature_key(secret_key, date, service)
|
54
|
+
signature = _hmac_sha256(signing_key, str2sign).hexdigest()
|
55
|
+
return signature
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2020-11-30 17:17
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
import sys
|
8
|
+
|
9
|
+
|
10
|
+
class SelfException(Exception):
|
11
|
+
|
12
|
+
def __init__(self, code=None, message=None, requestId=None):
|
13
|
+
self.code = code
|
14
|
+
self.message = message
|
15
|
+
self.requestId = requestId
|
16
|
+
|
17
|
+
def __str__(self):
|
18
|
+
s = "[SelfException] code:%s message:%s requestId:%s" % (
|
19
|
+
self.code, self.message, self.requestId)
|
20
|
+
if sys.version_info[0] < 3 and isinstance(s, unicode):
|
21
|
+
return s.encode("utf8")
|
22
|
+
else:
|
23
|
+
return s
|
24
|
+
|
25
|
+
|
26
|
+
def get_code(self):
|
27
|
+
return self.code
|
28
|
+
|
29
|
+
def get_message(self):
|
30
|
+
return self.message
|
31
|
+
|
32
|
+
def get_request_id(self):
|
33
|
+
return self.requestId
|
eric_tools/ip.py
ADDED
@@ -0,0 +1,30 @@
|
|
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)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2021-03-19 13:26
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
|
8
|
+
from jose.exceptions import ExpiredSignatureError, JWTError
|
9
|
+
from jose import jwt
|
10
|
+
import uuid
|
11
|
+
from datetime import datetime,timedelta
|
12
|
+
|
13
|
+
class GenerateAuthenticate(object):
|
14
|
+
def __init__(self,secretKey,cipher_text):
|
15
|
+
self.secretKey = secretKey
|
16
|
+
self.cipher_text = cipher_text
|
17
|
+
super(GenerateAuthenticate,self).__init__(secret_key=secretKey,cipher_text=cipher_text)
|
18
|
+
|
19
|
+
@staticmethod
|
20
|
+
def generate_access_token(SECRET_KEY, Plaintext):
|
21
|
+
expire = datetime.utcnow() + timedelta(minutes=1)
|
22
|
+
to_encode = {"exp": expire, "sub": str(Plaintext), "uid": str(uuid.uuid4())}
|
23
|
+
token = jwt.encode(to_encode, SECRET_KEY, algorithm="HS256")
|
24
|
+
return token
|
25
|
+
|
26
|
+
@staticmethod
|
27
|
+
def check_access_token(Ciphertext, secretKey):
|
28
|
+
try:
|
29
|
+
payload = jwt.decode(Ciphertext, secretKey, algorithms="HS256")
|
30
|
+
import sys
|
31
|
+
if isinstance(payload, unicode) or sys.version_info[0] < 3:
|
32
|
+
print str(payload).encode('utf-8').replace('u\'', '')
|
33
|
+
else:
|
34
|
+
print(payload)
|
35
|
+
return payload
|
36
|
+
|
37
|
+
except ExpiredSignatureError:
|
38
|
+
print(u"token过期")
|
39
|
+
except JWTError:
|
40
|
+
print(u"token验证失败")
|
eric_tools/logger.py
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2020-11-30 11:09
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
__all__ =['Logger','FuncLog']
|
8
|
+
|
9
|
+
import logging
|
10
|
+
import traceback
|
11
|
+
from logging import handlers
|
12
|
+
from logging.handlers import TimedRotatingFileHandler
|
13
|
+
|
14
|
+
|
15
|
+
class Logger(object):
|
16
|
+
level_relations = {
|
17
|
+
'debug': logging.DEBUG,
|
18
|
+
'info': logging.INFO,
|
19
|
+
'warning': logging.WARNING,
|
20
|
+
'error': logging.ERROR,
|
21
|
+
'crit': logging.CRITICAL
|
22
|
+
} # 日志级别关系映射
|
23
|
+
|
24
|
+
def __init__(self, filename, level='info', when='D', backCount=3,
|
25
|
+
fmt='%(asctime)s - %(pathname)s[line:%(lineno)d-%(funcName)s] - %(levelname)s: %(message)s'):
|
26
|
+
self.logger = logging.getLogger(filename)
|
27
|
+
format_str = logging.Formatter(fmt) # 设置日志格式
|
28
|
+
self.logger.setLevel(self.level_relations.get(level)) # 设置日志级别
|
29
|
+
sh = logging.StreamHandler() # 往屏幕上输出
|
30
|
+
sh.setFormatter(format_str) # 设置屏幕上显示的格式
|
31
|
+
th = handlers.TimedRotatingFileHandler(filename=filename, when=when, backupCount=backCount,
|
32
|
+
encoding='utf-8') # 往文件里写入#指定间隔时间自动生成文件的处理器
|
33
|
+
# 实例化TimedRotatingFileHandler
|
34
|
+
# interval是时间间隔,backupCount是备份文件的个数,如果超过这个个数,就会自动删除,when是间隔的时间单位,单位有以下几种:
|
35
|
+
# S 秒 M 分 H 小时、D 天、
|
36
|
+
# W 每星期(interval==0时代表星期一)
|
37
|
+
# midnight 每天凌晨
|
38
|
+
th.setFormatter(format_str) # 设置文件里写入的格式
|
39
|
+
self.logger.addHandler(sh) # 把对象加到logger里
|
40
|
+
self.logger.addHandler(th)
|
41
|
+
|
42
|
+
|
43
|
+
class FuncLog(object):
|
44
|
+
@staticmethod
|
45
|
+
def loggerInFile(filename): # 带参数的装饰器需要2层装饰器实现,第一层传参数,第二层传函数,每层函数在上一层返回
|
46
|
+
def decorator(func):
|
47
|
+
def inner(*args, **kwargs): # 1
|
48
|
+
logger = logging.getLogger(filename)
|
49
|
+
logger.setLevel(logging.INFO)
|
50
|
+
handler = TimedRotatingFileHandler(filename,
|
51
|
+
when="d",
|
52
|
+
interval=1,
|
53
|
+
backupCount=5)
|
54
|
+
formatter = logging.Formatter(
|
55
|
+
'%(asctime)s - %(pathname)s[line:%(lineno)d-%(funcName)s] - %(levelname)s: %(message)s')
|
56
|
+
console =logging.StreamHandler()
|
57
|
+
console.setLevel(logging.INFO)
|
58
|
+
console.setFormatter(formatter)
|
59
|
+
handler.setFormatter(formatter)
|
60
|
+
logger.addHandler(handler)
|
61
|
+
logger.addHandler(console)
|
62
|
+
try:
|
63
|
+
result = func(*args, **kwargs) # 2
|
64
|
+
logger.info(result)
|
65
|
+
except:
|
66
|
+
logger.error(traceback.format_exc())
|
67
|
+
|
68
|
+
return inner
|
69
|
+
return decorator
|
eric_tools/pgsql.py
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2021-01-27 16:08
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
import psycopg2
|
8
|
+
|
9
|
+
|
10
|
+
class PostgreSQL(object):
|
11
|
+
def __init__(self, database, user, password, host, port=5432):
|
12
|
+
self.database = database
|
13
|
+
self.user = user
|
14
|
+
self.password = password
|
15
|
+
self.host = host
|
16
|
+
self.port = port
|
17
|
+
|
18
|
+
def __str__(self):
|
19
|
+
return '{0},{1},{2}'.format(self.database, self.user, self.host)
|
20
|
+
|
21
|
+
def __repr__(self):
|
22
|
+
return "Database:%s User:%s Host:%s" % (self.database, self.user, self.host)
|
23
|
+
|
24
|
+
def __setattr__(self, key, value):
|
25
|
+
self.__dict__[key] = value
|
26
|
+
|
27
|
+
def __getattr__(self, item):
|
28
|
+
print self.__dict__[item]
|
29
|
+
return self.__dict__[item]
|
30
|
+
|
31
|
+
def __call__(self, *args, **kwargs):
|
32
|
+
print '%s'% PostgreSQL.__dict__
|
33
|
+
|
34
|
+
@property
|
35
|
+
def info(self):
|
36
|
+
return psycopg2.__version__,psycopg2.__doc__
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
def operate(self, sql, params):
|
41
|
+
count = 0
|
42
|
+
try:
|
43
|
+
self.connect()
|
44
|
+
count = self.cursor.execute(sql, params)
|
45
|
+
self.conn.commit()
|
46
|
+
self.close()
|
47
|
+
except Exception, e:
|
48
|
+
print e.message
|
49
|
+
return count
|
50
|
+
|
51
|
+
def connect(self):
|
52
|
+
self.conn = psycopg2.connect(database=self.database, host=self.host, port=self.port, user=self.user,
|
53
|
+
password=self.password)
|
54
|
+
|
55
|
+
self.cursor = self.conn.cursor()
|
56
|
+
|
57
|
+
def close(self):
|
58
|
+
self.cursor.close()
|
59
|
+
self.conn.close()
|
60
|
+
|
61
|
+
def get_one(self, sql, params=()):
|
62
|
+
result = None
|
63
|
+
try:
|
64
|
+
self.connect()
|
65
|
+
self.cursor.execute(sql, params)
|
66
|
+
result = self.cursor.fetchone()
|
67
|
+
self.close()
|
68
|
+
except Exception, e:
|
69
|
+
print e.message
|
70
|
+
return result
|
71
|
+
|
72
|
+
def get_all(self, sql, params=()):
|
73
|
+
tup = ()
|
74
|
+
try:
|
75
|
+
self.connect()
|
76
|
+
self.cursor.execute(sql, params)
|
77
|
+
tup = self.cursor.fetchall()
|
78
|
+
self.close()
|
79
|
+
except Exception, e:
|
80
|
+
print e.message
|
81
|
+
return tup
|
82
|
+
|
83
|
+
def insert(self, sql, params=()):
|
84
|
+
return self.operate(sql, params)
|
85
|
+
|
86
|
+
def update(self, sql, params=()):
|
87
|
+
return self.operate(sql, params)
|
88
|
+
|
89
|
+
def delete(self, sql, params=()):
|
90
|
+
return self.operate(sql, params)
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
eric_tools/readconfig.py
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2021-02-07 14:01
|
5
|
+
@IDE : PyCharm
|
6
|
+
'''
|
7
|
+
import sys
|
8
|
+
|
9
|
+
import configparser
|
10
|
+
|
11
|
+
# proDir = os.path.split(os.path.realpath(__file__))[0]
|
12
|
+
# configPath = os.path.join(proDir, "config.ini")
|
13
|
+
|
14
|
+
|
15
|
+
class ReadConfig(object):
|
16
|
+
def __init__(self, configPath,title, name):
|
17
|
+
self.conf = configparser.ConfigParser()
|
18
|
+
self.title = title
|
19
|
+
self.name = name
|
20
|
+
self.conf.read(configPath, encoding='utf-8')
|
21
|
+
self.conf.get(title, name)
|
22
|
+
print self.conf.get(title, name)
|
23
|
+
|
24
|
+
|
25
|
+
def __repr__(self):
|
26
|
+
if sys.version_info < 3:
|
27
|
+
print '%s' % self.conf.get(self.title, self.name)
|
28
|
+
else:
|
29
|
+
print('%s' % self.conf.get(self.title, self.name))
|
30
|
+
|
eric_tools/remove.py
ADDED
@@ -0,0 +1,50 @@
|
|
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
|
+
'''remove file'''
|
21
|
+
|
22
|
+
date = datetime.datetime.fromtimestamp(os.path.getmtime(filename))
|
23
|
+
now = datetime.datetime.now()
|
24
|
+
|
25
|
+
if (now - date).seconds > timedifference:
|
26
|
+
if os.path.exists(filename):
|
27
|
+
os.remove(filename)
|
28
|
+
print 'remove file: %s' % filename
|
29
|
+
else:
|
30
|
+
print 'no such file: %s' % filename
|
31
|
+
|
32
|
+
|
33
|
+
FILE_DIR = '/home'
|
34
|
+
|
35
|
+
if __name__ == '__main__':
|
36
|
+
|
37
|
+
print 'Script is running...'
|
38
|
+
|
39
|
+
while True:
|
40
|
+
ITEMS = os.listdir(FILE_DIR)
|
41
|
+
NEWLIST = []
|
42
|
+
for names in ITEMS:
|
43
|
+
if names.endswith(".txt"):
|
44
|
+
NEWLIST.append(FILE_DIR + names)
|
45
|
+
|
46
|
+
for names in NEWLIST:
|
47
|
+
print 'current file: %s' % (names)
|
48
|
+
RemoveFile.fileremove(names, 10)
|
49
|
+
|
50
|
+
time.sleep(2)
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
2
|
+
'''
|
3
|
+
@Author : Eric
|
4
|
+
@Time : 2020-08-07 09:24
|
5
|
+
'''
|
6
|
+
import base64
|
7
|
+
__all__ =['image_resize_image','encode_base64','decode_base64']
|
8
|
+
__author__ = 'Eric'
|
9
|
+
__doc__ = "压缩图片 默认像素1024*1024"
|
10
|
+
|
11
|
+
try:
|
12
|
+
import cStringIO as StringIO
|
13
|
+
except ImportError:
|
14
|
+
try:
|
15
|
+
import StringIO
|
16
|
+
except ImportError:
|
17
|
+
from io import StringIO
|
18
|
+
|
19
|
+
|
20
|
+
from PIL import Image
|
21
|
+
from PIL import ImageEnhance
|
22
|
+
|
23
|
+
def encode_base64(file_path):
|
24
|
+
with open(file_path,'rb') as f:
|
25
|
+
image_data = f.read()
|
26
|
+
base64_data = base64.b64encode(image_data)
|
27
|
+
return base64_data
|
28
|
+
def decode_base64(fname,base64_data):
|
29
|
+
with open(fname,'wb') as file:
|
30
|
+
decode_data = base64.b64decode(base64_data) # 解码
|
31
|
+
file.write(decode_data)
|
32
|
+
|
33
|
+
|
34
|
+
# source_data = encode_base64('/Users/eric/Documents/photo/2a4100008d310b5fd8a8.jpeg')
|
35
|
+
|
36
|
+
def image_resize_image(base64_source, size=(1024, 1024), encoding='base64', filetype=None, avoid_if_small=False):
|
37
|
+
|
38
|
+
if not base64_source:
|
39
|
+
return False
|
40
|
+
if size == (None, None):
|
41
|
+
return base64_source
|
42
|
+
image_stream = StringIO.StringIO(base64_source.decode(encoding))
|
43
|
+
image = Image.open(image_stream)
|
44
|
+
# store filetype here, as Image.new below will lose image.format
|
45
|
+
filetype = (filetype or image.format).upper()
|
46
|
+
|
47
|
+
filetype = {
|
48
|
+
'BMP': 'PNG',
|
49
|
+
}.get(filetype, filetype)
|
50
|
+
|
51
|
+
asked_width, asked_height = size
|
52
|
+
if asked_width is None:
|
53
|
+
asked_width = int(image.size[0] * (float(asked_height) / image.size[1]))
|
54
|
+
if asked_height is None:
|
55
|
+
asked_height = int(image.size[1] * (float(asked_width) / image.size[0]))
|
56
|
+
size = asked_width, asked_height
|
57
|
+
|
58
|
+
# check image size: do not create a thumbnail if avoiding smaller images
|
59
|
+
if avoid_if_small and image.size[0] <= size[0] and image.size[1] <= size[1]:
|
60
|
+
return base64_source
|
61
|
+
|
62
|
+
if image.size != size:
|
63
|
+
image = image_resize_and_sharpen(image, size)
|
64
|
+
if image.mode not in ["1", "L", "P", "RGB", "RGBA"]:
|
65
|
+
image = image.convert("RGB")
|
66
|
+
|
67
|
+
background_stream = StringIO.StringIO()
|
68
|
+
image.save(background_stream, filetype)
|
69
|
+
return background_stream.getvalue().encode(encoding)
|
70
|
+
|
71
|
+
def image_resize_and_sharpen(image, size, preserve_aspect_ratio=False, factor=2.0):
|
72
|
+
|
73
|
+
if image.mode != 'RGBA':
|
74
|
+
image = image.convert('RGBA')
|
75
|
+
image.thumbnail(size, Image.ANTIALIAS)
|
76
|
+
if preserve_aspect_ratio:
|
77
|
+
size = image.size
|
78
|
+
sharpener = ImageEnhance.Sharpness(image)
|
79
|
+
resized_image = sharpener.enhance(factor)
|
80
|
+
# create a transparent image for background and paste the image on it
|
81
|
+
image = Image.new('RGBA', size, (255, 255, 255, 0))
|
82
|
+
image.paste(resized_image, ((size[0] - resized_image.size[0]) / 2, (size[1] - resized_image.size[1]) / 2))
|
83
|
+
return image
|
84
|
+
|
85
|
+
# coding = image_resize_image(source_data)
|
86
|
+
# decode_base64('风景.jpg',coding)
|
eric_tools/send_email.py
ADDED
@@ -0,0 +1,35 @@
|
|
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
|
+
import sys
|
14
|
+
reload(sys)
|
15
|
+
sys.setdefaultencoding("utf-8")
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
def mail(send_email,receive_email,send_nickname,receive_nickname,pwd):
|
21
|
+
try:
|
22
|
+
msg = MIMEText('Test QQ Email', 'plain', 'utf-8')
|
23
|
+
msg['From'] = formataddr([send_nickname, send_email]) # 括号里的对应发件人邮箱昵称、发件人邮箱账号
|
24
|
+
msg['To'] = formataddr([receive_nickname, receive_email]) # 括号里的对应收件人邮箱昵称、收件人邮箱账号
|
25
|
+
msg['Subject'] = str("发送邮件测试").decode('utf-8') # 邮件的主题,也可以说是标题
|
26
|
+
|
27
|
+
server = smtplib.SMTP_SSL("smtp.qq.com", 465) # 发件人邮箱中的SMTP服务器,端口是25
|
28
|
+
server.login(send_email, pwd)
|
29
|
+
server.sendmail(send_email, [receive_email, ], msg.as_string()) # 括号中对应的是发件人邮箱账号、收件人邮箱账号、发送邮件
|
30
|
+
server.quit() # 关闭连接
|
31
|
+
except Exception as e:
|
32
|
+
print '发送邮件失败:%s' % e
|
33
|
+
return e
|
34
|
+
|
35
|
+
|
eric_tools/sftp.py
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
+
|
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
@@ -0,0 +1,65 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: eric-tools
|
3
|
+
Version: 1.2.5
|
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
|
+
Requires-Dist: psycopg2
|
17
|
+
Requires-Dist: requests
|
18
|
+
Requires-Dist: paramiko
|
19
|
+
Requires-Dist: Pillow
|
20
|
+
|
21
|
+
# Tools
|
22
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
23
|
+

|
24
|
+

|
25
|
+
|
26
|
+
|
27
|
+
[New Year](https://eric-jxl.github.io/bak/index.html)
|
28
|
+
|
29
|
+
|
30
|
+
#### Project management of Python daily tools
|
31
|
+
```shell
|
32
|
+
pip install eric_tools
|
33
|
+
```
|
34
|
+
|
35
|
+
```
|
36
|
+
encryption_classmethod.py Python HMAC+MD5加密签名算法
|
37
|
+
|
38
|
+
exception_class.py 异常类
|
39
|
+
|
40
|
+
resize_image.py 图片压缩
|
41
|
+
|
42
|
+
ip.py ip地址定位API
|
43
|
+
|
44
|
+
logger.py 日志模块类和高级日志装饰器
|
45
|
+
|
46
|
+
remove.py 删除文件
|
47
|
+
|
48
|
+
send_email.py 发送邮件
|
49
|
+
|
50
|
+
sftp.py ssh远程下载文件
|
51
|
+
|
52
|
+
pgsql.py 对postgresql 增删改查操作
|
53
|
+
|
54
|
+
readconfig 针对读取配置文件
|
55
|
+
|
56
|
+
jwt_encrypt 生成jwt Access Token 加密及解密
|
57
|
+
|
58
|
+
convert_json 支持json和object之间转换
|
59
|
+
|
60
|
+
Abstract.py 抽象类模型
|
61
|
+
|
62
|
+
decorator.py 惰性属性装饰器
|
63
|
+
```
|
64
|
+
|
65
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
eric_tools/Abstract.py,sha256=8HpTno0VnviyYaRvc2whTUfUJefg2tZhgR94RU9f-FQ,1619
|
2
|
+
eric_tools/__init__.py,sha256=25CH7Sv2SiBYP25vO9qRYF4Akd8FhiK582-YGBpqvwE,565
|
3
|
+
eric_tools/convert_json.py,sha256=Qcs8VQGB7cBkwAiqH1Xd9vbagw19sA2bE9s4EJFA33E,638
|
4
|
+
eric_tools/decorator.py,sha256=DEN_-TSvtAo0TWvs_7-HbeMQCqdgVAkxz2K5fekYFbM,1887
|
5
|
+
eric_tools/encryption_classmethod.py,sha256=JaR0rBnaxOEWxOtoOZ6qN1x31Zm1boh5kw264juHLWg,1662
|
6
|
+
eric_tools/exception_class.py,sha256=4ntO2ynm3D9tGoeJ538OGKKsudqhoDRw-fpFd4X6Hy0,741
|
7
|
+
eric_tools/ip.py,sha256=TqeWnJe2M5HhoI8WGNFwyYrsI7kYDQ4PBDBDIDjLSkc,915
|
8
|
+
eric_tools/jwt_encrypt.py,sha256=qiKlitswvC44xpDft8_Iekk8Ewc1HeUA7_Ayc7jFwEY,1324
|
9
|
+
eric_tools/logger.py,sha256=zvpDv0YpeXZld2w2yPIuosfLWdbdvOqSQsJS2PtstXQ,3058
|
10
|
+
eric_tools/pgsql.py,sha256=hYt9GwdpobHOoQ6SAemlyN0zlo0X0niYiTcG-2yWEeQ,2320
|
11
|
+
eric_tools/readconfig.py,sha256=Wosz96C1RFITBN2pgfw-TlX7C-wnOiLcDowb7mITysk,737
|
12
|
+
eric_tools/remove.py,sha256=RtnNFZzvRc-YNKdDb0h9zVZAPXyDSM1nVcUHTFEjQGk,1163
|
13
|
+
eric_tools/resize_image.py,sha256=A2OBCF7XfnQesWIYTs2W1jmZDslftagPxcc-Fijmyoo,2855
|
14
|
+
eric_tools/send_email.py,sha256=kWVYG5O5hdV4Rk8aTxwkEIkzEXSEw7Hu_aAAQKIjBws,1230
|
15
|
+
eric_tools/sftp.py,sha256=UUBmy4R-7Pezo9haA8JufDyJRcxZg2pKquX0KJIDZIw,423
|
16
|
+
eric_tools-1.2.5.dist-info/LICENSE,sha256=wURoCIWynkcZ4qUfCqtUOaHgLZgGkrWq8IbK4Scn8os,10849
|
17
|
+
eric_tools-1.2.5.dist-info/METADATA,sha256=COmSfA4wdjAKmFFAKHLNrkmMKFR3GJDOfeo2QaKq-3I,1581
|
18
|
+
eric_tools-1.2.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
19
|
+
eric_tools-1.2.5.dist-info/top_level.txt,sha256=mtO1Tce6qLPcuy4F8bXHByXuIb2LSAEkQEqeQ3UZpzU,11
|
20
|
+
eric_tools-1.2.5.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
eric_tools
|