Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
6220 connectés 

  FORUM HardWare.fr
  Programmation
  Python

  [python] urllib.urlretrieve(myURL) ...

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[python] urllib.urlretrieve(myURL) ...

n°166084
TBone
Pouet.
Posté le 26-06-2002 à 10:34:14  profilanswer
 

salut,
 
je voudrais rapartier un fichier distant...
 
(linux)
 
j'utilise urllib.urlretrieve() pour récupérer un fichier ce qui me paraît pratique mais lorsque je vérifie ce qu'il me ramène, c'est déposé dans /var/tmp/@...  
alors que je voudrais le déposer dans un répertoire spécifié...
 
pour l'instant je copie de /var/tmp là où je le veux mais à terme c'est pour rapatrier des backups de serveurs... donc je voudrais stocker les (gros) fichiers directement au bon endroit...
 
il y a une astuce ? (très certainement... je débute!)
 
merci!


---------------
A straight line is a special case of a curve. It's a curve which is uncurved. -- Susskind.
mood
Publicité
Posté le 26-06-2002 à 10:34:14  profilanswer
 

n°166859
TBone
Pouet.
Posté le 27-06-2002 à 07:49:15  profilanswer
 

:(


---------------
A straight line is a special case of a curve. It's a curve which is uncurved. -- Susskind.
n°168011
TBone
Pouet.
Posté le 28-06-2002 à 12:54:03  profilanswer
 

d'accord... :D


---------------
A straight line is a special case of a curve. It's a curve which is uncurved. -- Susskind.
n°169346
max_payne
Posté le 01-07-2002 à 23:57:21  profilanswer
 

je voudrais bien t'aider mais je débute en python (en même en tout ce qui est programmation)  
 
voila j'espère qu'il y aura d'autre réponse ...
 
 
à la revoyure

n°170890
TBone
Pouet.
Posté le 04-07-2002 à 09:45:32  profilanswer
 

:sweat:  
 
bah je vais contourner le problème en gérant la connexion à la main. je n'ai pas trop eu le temps j> ici mais ça devrait fonctionner.


---------------
A straight line is a special case of a curve. It's a curve which is uncurved. -- Susskind.
n°171092
Jar Jar
Intaigriste
Posté le 04-07-2002 à 13:09:36  profilanswer
 

urlretrieve(url[, filename[, reporthook[, data]]])
    Copy a network object denoted by a URL to a local file, if necessary. If the URL points to a local file, or a valid cached copy of the object exists, the object is not copied. Return a tuple (filename, headers) where filename is the local file name under which the object can be found, and headers is either None (for a local object) or whatever the info() method of the object returned by urlopen() returned (for a remote object, possibly cached). Exceptions are the same as for urlopen().
 
    [b]The second argument, if present, specifies the file location to copy to[/b] (if absent, the location will be a tempfile with a generated name). The third argument, if present, is a hook function that will be called once on establishment of the network connection and once after each block read thereafter. The hook will be passed three arguments; a count of blocks transferred so far, a block size in bytes, and the total size of the file. The third argument may be -1 on older FTP servers which do not return a file size in response to a retrieval request.
 
If the url uses the http: scheme identifier, the optional data argument may be given to specify a POST request (normally the request type is GET). The data argument must in standard application/x-www-form-urlencoded format; see the urlencode() function below.


---------------
« No question is too silly to ask, but, of course, some are too silly to answer. » -- Perl book
n°171364
TBone
Pouet.
Posté le 04-07-2002 à 17:32:41  profilanswer
 

:ouch: en effet, je me demande comment je suis passé à côté...
 
j'ai un souci de target car j'ai toujours un "404 not found" malgré une URL bien formée mais ça avance.
 
je vais relire _tout_ ce passage.


---------------
A straight line is a special case of a curve. It's a curve which is uncurved. -- Susskind.
n°171376
TBone
Pouet.
Posté le 04-07-2002 à 17:46:04  profilanswer
 

n'empêche... le urllib ne me ramène le target que si je chatouille  apache avec un navigateur juste avant... :/
 
j'ai fait une copie du link vu par Mozilla et collé dans python en mode console (à savoir http://192.168.0.10/help.text et il le prend... mais si j'attends un peu, le script ramène "404 not found" au lieu du contenu de help.text. :??:


Message édité par TBone le 04-07-2002 à 17:46:32

---------------
A straight line is a special case of a curve. It's a curve which is uncurved. -- Susskind.
n°172259
lorill
Posté le 06-07-2002 à 13:12:53  profilanswer
 

etrange...
je suppose qu'un urllip.urlopen() suivi d'une ecriture manuelle a l'écran ou dans fichier te fait la même erreur ?


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Python

  [python] urllib.urlretrieve(myURL) ...

 

Sujets relatifs
[Python] wxHtmlWindow[Python] lancer un executable à partir d'un script Python
permutation en python[python] : calcul de nombre premier
Qui sait faire un convertisseur DEC=>BIN en langage python ??[Python] Probleme pour installer les modules!!!
[Python]Que peut on faire comme graphisme avec Python?[python]
convertion de perl en pythonpython C,C++ et l'accès à des bases de données!De l'aide SVP!!!!
Plus de sujets relatifs à : [python] urllib.urlretrieve(myURL) ...


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)