summaryrefslogtreecommitdiff
path: root/ATRI/modules/b64/__init__.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-10-07 13:03:27 +0800
committerKyomotoi <[email protected]>2020-10-07 13:03:27 +0800
commitcec804951b97bcab81551bb8c7a1a1e1c473aaa7 (patch)
tree03b7204af6ebc869e887494ab2609a6e9b7fd72c /ATRI/modules/b64/__init__.py
parentab467e8788b7ef8382bab63fb1a91c8b6305c501 (diff)
downloadATRI-cec804951b97bcab81551bb8c7a1a1e1c473aaa7.tar.gz
ATRI-cec804951b97bcab81551bb8c7a1a1e1c473aaa7.tar.bz2
ATRI-cec804951b97bcab81551bb8c7a1a1e1c473aaa7.zip
[Update]
Diffstat (limited to 'ATRI/modules/b64/__init__.py')
-rw-r--r--ATRI/modules/b64/__init__.py26
1 files changed, 0 insertions, 26 deletions
diff --git a/ATRI/modules/b64/__init__.py b/ATRI/modules/b64/__init__.py
deleted file mode 100644
index 8cce6e0..0000000
--- a/ATRI/modules/b64/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import os
-import time
-import base64
-import requests
-from pathlib import Path
-
-
-path_temp_img = Path('.') / 'ATRI' / 'data' / 'temp' / 'img'
-
-
-def b64_str_img_url(url: str):
- img_d = requests.get(url)
- name = 'temp.jpg'
- find_img = Path('.') / 'ATRI' / 'data' / 'temp' / 'img' / f'{name}'
- with open(find_img, 'wb') as f:
- f.write(img_d.content)
- if find_img.stat().st_size >= 1000000:
- print('超过1MB,跳过!')
- return
- else:
- with open(find_img, 'rb') as f:
- content = f.read()
- b64_str = base64.b64encode(content).decode()
- time.sleep(1)
- os.remove(str(path_temp_img) + '/' + name)
- return b64_str \ No newline at end of file