python - How to join downloaded file parts -


so , trying download single file in parts using python threading module , requests download.

now thing able download file 4 separate parts not able join them.

i tried using pypdf2 join pdf , ffmpeg join video files no help. not able open of downloaded files explains not getting downloaded correctly.

pypdf2 giving error

pdfreaderror: eof marker not found

what should that able join files correctly.
secondly , have use seperate methods join them, or can implement 1 method can used different file formats
below download function implemented.

def download(threadid, drange, url):     headers = {"range":"bytes={0}-{1}".format(drange[0], drange[1])}     print headers      size = drange[1] - drange[0]     print "starting thread {0}".format(threadid)     req = requests.get(url, headers=headers, stream=true)      download_status[size] = size     download_status[threadid] = 0     # return req     open('test{0}.mp4'.format(threadid), 'wb') f:         r in pr.bar(req.iter_content(chunk_size=2048), expected_size=(size/2048)+1):             if r:                 f.write(r)                 f.flush() 


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -