I have a working solution. :)
The function below will download a file securely.
Thank anyone who helped. I wouldn't be able to write this function without your
help.
I hope, someone else will benefit from our united work.
Best regards.
import os
import urllib.request
def Download(rfile, lfile):
On 2015-07-02 21:27, zljubi...@gmail.com wrote:
This is my final version which doesn't work. :(
Actually, it works with another file on another server, but doesn't work with
mp4 files on this particular server.
I really don't know what to do?
Regards.
import os
import urllib.request
def Down
On 2-7-2015 22:27, zljubi...@gmail.com wrote:
> This is my final version which doesn't work. :(
> Actually, it works with another file on another server, but doesn't work with
> mp4 files on this particular server.
>
> I really don't know what to do?
Do you really need to download these files us
This is my final version which doesn't work. :(
Actually, it works with another file on another server, but doesn't work with
mp4 files on this particular server.
I really don't know what to do?
Regards.
import os
import urllib.request
def Download(rfile, lfile):
retval = False
if os
On 2015-07-01 21:51, Peter Otten wrote:
> use a loop:
>
> CHUNKSIZE = 16*1024 # for example
> while True:
>data = response.read(CHUNKSIZE)
>if not data:
>break
>out_file.write(data)
>
>
> This can be simplified:
>
> shutil.copyfileobj(response, out_file)
It's these little
On 01Jul2015 21:51, Peter Otten <__pete...@web.de> wrote:
zljubi...@gmail.com wrote:
But how to read chunks?
Instead of
data = response.read() # a `bytes` object
out_file.write(data)
use a loop:
CHUNKSIZE = 16*1024 # for example
while True:
data = response.read(CHUNKSI
zljubi...@gmail.com wrote:
> New version with chunks:
>
> import os
> import urllib.request
>
> def Download(rfile, lfile):
>
> retval = False
>
> if os.path.isfile(lfile):
> lsize = os.stat(lfile).st_size
> else:
> lsize = 0
>
> req = urllib.request.Request(rf
New version with chunks:
import os
import urllib.request
def Download(rfile, lfile):
retval = False
if os.path.isfile(lfile):
lsize = os.stat(lfile).st_size
else:
lsize = 0
req = urllib.request.Request(rfile)
req.add_header('Range', "bytes={}-".format(lsize)
zljubi...@gmail.com wrote:
> But how to read chunks?
Instead of
> data = response.read() # a `bytes` object
> out_file.write(data)
use a loop:
CHUNKSIZE = 16*1024 # for example
while True:
data = response.read(CHUNKSIZE)
if not data:
break
out_file.write(data)
But how to read chunks?
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Jul 2, 2015 at 5:24 AM, wrote:
> with urllib.request.urlopen(req) as response, open(lfile, 'ab') as
> out_file:
> data = response.read() # a `bytes` object
> out_file.write(data)
>
If a file is big enough to want to resume the download once, you
almost certainly want
Currently I am executing the following code:
import os
import urllib.request
def Download(rfile, lfile):
retval = False
if os.path.isfile(lfile):
lsize = os.stat(lfile).st_size
else:
lsize = 0
req = urllib.request.Request(rfile)
req.add_header('Range', "byte
On Wed, Jul 1, 2015 at 8:18 AM, wrote:
> if I understood you correctly (I am not sure about which example you are
> refering), I should do the following:
> 1. check already downloaded file size in bytes = downloaded
> 2. url = 'http://video.hrt.hr/2906/otv296.mp4'
> 3. req = urllib.request.Reque
On Wednesday, 1 July 2015 01:43:19 UTC+2, Cameron Simpson wrote:
> On 30Jun2015 08:34, zljubi...@gmail.com wrote:
> >I would like to download a file (http://video.hrt.hr/2906/otv296.mp4)
> >If the connection is OK, I can download the file with:
> >
> >import urllib.request
> >urllib.request.urlre
On 30Jun2015 08:34, zljubi...@gmail.com wrote:
I would like to download a file (http://video.hrt.hr/2906/otv296.mp4)
If the connection is OK, I can download the file with:
import urllib.request
urllib.request.urlretrieve(remote_file, local_file)
Sometimes when I am connected on week wireless (
Hi,
I would like to download a file (http://video.hrt.hr/2906/otv296.mp4)
If the connection is OK, I can download the file with:
import urllib.request
urllib.request.urlretrieve(remote_file, local_file)
Sometimes when I am connected on week wireless (not mine) network I get
WinError 10054 exce
16 matches
Mail list logo