1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-05-11 17:34:56 +00:00

pyjwt==2.1.*

This commit is contained in:
lian 2021-05-11 11:44:32 +08:00
parent f1d458a6f9
commit 4cbc5a9346
2 changed files with 4 additions and 4 deletions

View File

@ -14,6 +14,6 @@ djangorestframework==3.11.1
python-dateutil
requests
pillow
pyjwt
pyjwt==2.1.*
pycryptodome
requests_oauthlib

View File

@ -1121,7 +1121,7 @@ if HAS_OFFICE_CONVERTER:
def add_office_convert_task(file_id, doctype, raw_path):
payload = {'exp': int(time.time()) + 300, }
token = jwt.encode(payload, seahub.settings.SECRET_KEY, algorithm='HS256')
headers = {"Authorization": "Token %s" % token.decode()}
headers = {"Authorization": "Token %s" % token}
params = {'file_id': file_id, 'doctype': doctype, 'raw_path': raw_path}
url = urljoin(OFFICE_CONVERTOR_ROOT, '/add-task')
requests.get(url, params, headers=headers)
@ -1130,7 +1130,7 @@ if HAS_OFFICE_CONVERTER:
def query_office_convert_status(file_id, doctype):
payload = {'exp': int(time.time()) + 300, }
token = jwt.encode(payload, seahub.settings.SECRET_KEY, algorithm='HS256')
headers = {"Authorization": "Token %s" % token.decode()}
headers = {"Authorization": "Token %s" % token}
params = {'file_id': file_id, 'doctype': doctype}
url = urljoin(OFFICE_CONVERTOR_ROOT, '/query-status')
d = requests.get(url, params, headers=headers)
@ -1158,7 +1158,7 @@ if HAS_OFFICE_CONVERTER:
url = urljoin(OFFICE_CONVERTOR_ROOT, '/get-converted-page')
payload = {'exp': int(time.time()) + 300, }
token = jwt.encode(payload, seahub.settings.SECRET_KEY, algorithm='HS256')
headers = {"Authorization": "Token %s" % token.decode()}
headers = {"Authorization": "Token %s" % token}
params = {'static_filename': static_filename, 'file_id': file_id}
try:
ret = requests.get(url, params, headers=headers)