|
@@ -1,7 +1,15 @@
|
|
|
|
+# -*- coding: utf-8 -*-
|
|
|
|
+"""
|
|
|
|
+Created on 2024-02-28
|
|
|
|
+---------
|
|
|
|
+@summary: 工具库
|
|
|
|
+---------
|
|
|
|
+@author: jy
|
|
|
|
+"""
|
|
|
|
+
|
|
|
|
+import re
|
|
import socket
|
|
import socket
|
|
-import hashlib
|
|
|
|
import time
|
|
import time
|
|
-import re
|
|
|
|
|
|
|
|
|
|
|
|
def clean_title(title):
|
|
def clean_title(title):
|
|
@@ -27,18 +35,15 @@ def get_host_ip():
|
|
return ip
|
|
return ip
|
|
|
|
|
|
|
|
|
|
-def sha1(text: str):
|
|
|
|
- """
|
|
|
|
- 十六进制数字字符串形式摘要值
|
|
|
|
-
|
|
|
|
- @param text: 字符串文本
|
|
|
|
- @return: 摘要值
|
|
|
|
- """
|
|
|
|
- _sha1 = hashlib.sha1()
|
|
|
|
- _sha1.update(text.encode("utf-8"))
|
|
|
|
- return _sha1.hexdigest()
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def wait(interval=None):
|
|
def wait(interval=None):
|
|
_interval = (interval or 600)
|
|
_interval = (interval or 600)
|
|
time.sleep(_interval)
|
|
time.sleep(_interval)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def date_to_timestamp(date, time_format="%Y-%m-%d %H:%M:%S"):
|
|
|
|
+ timestamp = time.mktime(time.strptime(date, time_format))
|
|
|
|
+ return int(timestamp)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def get_current_timestamp():
|
|
|
|
+ return int(time.time())
|