Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

Update pcs.py #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bcloud/pcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ def list_dir(cookie, tokens, path, page=1, num=100):
])
req = net.urlopen(url, headers={
'Content-type': const.CONTENT_FORM_UTF8,
'Cookie': cookie.sub_output('BAIDUID', 'BDUSS', 'PANWEB', 'cflag'),
'Cookie': cookie.sub_output('BAIDUID', 'BDUSS', 'PANWEB', 'cflag', 'SCRC', 'STOKEN'),
})
if req:
content = req.data
Expand Down Expand Up @@ -717,7 +717,7 @@ def get_download_link(cookie, tokens, path):
dlink = metas['info'][0]['dlink']
url = '{0}&cflg={1}'.format(dlink, cookie.get('cflag').value)
req = net.urlopen_without_redirect(url, headers={
'Cookie': cookie.sub_output('BAIDUID', 'BDUSS', 'cflag'),
'Cookie': cookie.sub_output('BAIDUID', 'BDUSS', 'cflag', 'SCRC', 'STOKEN'),
'Accept': const.ACCEPT_HTML,
})
if not req:
Expand Down Expand Up @@ -799,7 +799,7 @@ def upload(cookie, source_path, path, upload_mode):
'&ondup=', ondup,
'&dir=', encoder.encode_uri_component(dir_name),
'&filename=', encoder.encode_uri_component(file_name),
'&', cookie.sub_output('BDUSS'),
'&', cookie.sub_output('BDUSS', 'SCRC', 'STOKEN'),
])
with open(source_path, 'rb') as fh:
data = fh.read()
Expand Down Expand Up @@ -830,7 +830,7 @@ def rapid_upload(cookie, tokens, source_path, path, upload_mode):
'&content-md5=', content_md5,
'&slice-md5=', slice_md5,
'&path=', encoder.encode_uri_component(path),
'&', cookie.sub_output('BDUSS'),
'&', cookie.sub_output('BDUSS', 'SCRC', 'STOKEN'),
'&bdstoken=', tokens['bdstoken'],
])
req = net.urlopen(url, headers={'Cookie': cookie.header_output()})
Expand All @@ -850,7 +850,7 @@ def slice_upload(cookie, data):
url = ''.join([
const.PCS_URL_C,
'file?method=upload&type=tmpfile&app_id=250528',
'&', cookie.sub_output('BDUSS'),
'&', cookie.sub_output('BDUSS', 'SCRC', 'STOKEN'),
])
fields = []
files = [('file', ' ', data)]
Expand All @@ -872,7 +872,7 @@ def create_superfile(cookie, path, block_list):
const.PCS_URL_C,
'file?method=createsuperfile&app_id=250528',
'&path=', encoder.encode_uri_component(path),
'&', cookie.sub_output('BDUSS'),
'&', cookie.sub_output('BDUSS', 'SCRC', 'STOKEN'),
])
param = {'block_list': block_list}
data = 'param=' + json.dumps(param)
Expand Down Expand Up @@ -907,7 +907,7 @@ def get_metas(cookie, tokens, filelist, dlink=True):
data = ('dlink=0&target=' +
encoder.encode_uri_component(json.dumps(filelist)))
req = net.urlopen(url, headers={
'Cookie': cookie.sub_output('BDUSS'),
'Cookie': cookie.sub_output('BDUSS', 'SCRC', 'STOKEN'),
'Content-type': const.CONTENT_FORM,
}, data=data.encode())
if req:
Expand Down