---------- Mensaje Original ----------
A: Julian A. Charon Macias (julia...@mail.python.org)
De: Andrey Antoukh (and...@gmail.com)
Asunto: [***SPAM*** Score/Req: 05.70/5.0] Re: [Python-es] obtener tamaño 
fichero en URL
Fecha: 7/2/2012 9:47:26p

[n...@vaio.niwi.be][~]% python2
Python 2.7.2 (default, Nov 21 2011, 17:25:27) 
[GCC 4.6.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import requests
>>> requests.head
<function head at 0x15ea1b8>
>>> response = 
>>> requests.head("http://mirror.aarnet.edu.au/pub/archlinux/iso/2011..08.19/archlinux-2011.08.19-core-dual.iso";)
 >>> response.headers
{'last-modified': 'Fri, 19 Aug 2011 10:24:52 GMT', 'content-length': 
'705691648', 'etag': '"501df5-2a100000-4aad923cb6500"', 'date': 'Tue, 07 Feb 
2012 20:45:27 GMT', 'accept-ranges': 'bytes', 'content-type': 
'application/octet-stream', 'server': 'Apache/2.2.3 (Red Hat)'}
 >>> int(response.headers['content-length'])/1024.0/1024.0
673.0

Creo que con esto podria bastarte.La biblioteca que uso es requests. Puedes 
instalarla desde pypi.

El día 7 de febrero de 2012 15:34, Julian A. Charon Macias 
<julia...@fam.cug.co.cu> escribió:
 > Un saludo, como puedo obtener el tamaño(ej. 40 Mb)  de un fichero que este 
 > publicado en una direccion URL, mediante Python.
> creo que utilizando el modulo URLLIB, pero no veo como.
>
>
>
 >
 >
>
>
>
>
>
>
>
>
>
>
>
> --
> Lic. Julián A. Charón Macias
> Tel.  : 0294436
> A legendary Informatic
>
>
>
 >
>
> UNIVERSIDAD DE GUANTÁNAMO
>
>
> _______________________________________________
> Python-es mailing list
> Python-es@python.org
 > http://mail.python.org/mailman/listinfo/python-es
> FAQ: http://python-es-faq.wikidot.com/

 

-- 
Andrei Antoukh - <n...@niwi.be>
http://www.niwi..be/page/about/
http://www.kaleidos.net/A5694F/
 
"Linux is for people who hate Windows, BSD is for people who love UNIX"
"Social Engineer -> Because there is no patch for human stupidity"


 
Pero... esta biblioteca no viene de facto con Python?
Probe pero no vi resultados, me arroja mensaje que el modulo no existe, estoy 
usando Python 2.7.2 sobre win2.

alguna idea?












-- 
Lic. Julián A. Charón Macias
Tel.  : 0294436
A legendary Informatic





UNIVERSIDAD DE GUANTÁNAMO


_______________________________________________
Python-es mailing list
Python-es@python.org
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/

Responder a