mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
fix email
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': "odooai Odooapp Common Func",
|
'name': "odooai Odooapp Common Func",
|
||||||
'version': '16.23.08.17',
|
'version': '16.23.09.27',
|
||||||
'author': 'odooai.cn',
|
'author': 'odooai.cn',
|
||||||
'category': 'Base',
|
'category': 'Base',
|
||||||
'website': 'https://www.odooai.cn',
|
'website': 'https://www.odooai.cn',
|
||||||
|
|||||||
@@ -101,18 +101,21 @@ class Base(models.AbstractModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def get_image_from_url(self, url):
|
def get_image_from_url(self, url):
|
||||||
if not url:
|
|
||||||
return None
|
|
||||||
try:
|
|
||||||
response = requests.get(url) # 将这个图片保存在内存
|
|
||||||
except Exception as e:
|
|
||||||
return None
|
|
||||||
# 返回这个图片的base64编码
|
# 返回这个图片的base64编码
|
||||||
return base64.b64encode(BytesIO(response.content).read())
|
return get_image_from_url(url)
|
||||||
|
|
||||||
def get_ua_type(self):
|
def get_ua_type(self):
|
||||||
return get_ua_type()
|
return get_ua_type()
|
||||||
|
|
||||||
|
def get_image_from_url(url):
|
||||||
|
if not url:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
response = requests.get(url, timeout=5)
|
||||||
|
except Exception as e:
|
||||||
|
return None
|
||||||
|
# 返回这个图片的base64编码
|
||||||
|
return base64.b64encode(BytesIO(response.content).read())
|
||||||
|
|
||||||
def get_ua_type():
|
def get_ua_type():
|
||||||
ua = request.httprequest.headers.get('User-Agent')
|
ua = request.httprequest.headers.get('User-Agent')
|
||||||
|
|||||||
Reference in New Issue
Block a user