同步系统化参数,同步每日数据
This commit is contained in:
1
sf_base/commons/__init__.py
Normal file
1
sf_base/commons/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from. import common
|
||||
28
sf_base/commons/common.py
Normal file
28
sf_base/commons/common.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import fields, models, api
|
||||
import time
|
||||
import hashlib
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Common(models.Model):
|
||||
_name = 'sf.sync.common'
|
||||
_description = u'公用类'
|
||||
|
||||
|
||||
|
||||
def get_headers(self,token,mrs_secret_key):
|
||||
'''
|
||||
获取requests中的heardes参数
|
||||
'''
|
||||
timestamp = int(time.time())
|
||||
check_str = '%s%s%s' % (token, timestamp, mrs_secret_key)
|
||||
check_mrs_str = hashlib.sha1(check_str.encode('utf-8')).hexdigest()
|
||||
headers = {'TOKEN': token,
|
||||
'TIMESTAMP': str(timestamp),
|
||||
'checkstr': check_mrs_str}
|
||||
return headers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user