Viewing File: /usr/lib/python2.7/site-packages/euca2ools/commands/s3/getobject.pyo

ó
ĄôXc@s™ddlZddlZddlZddlmZddlmZddlm	Z	ddl
Z
ddlmZddl
Zdee	fd„ƒYZdS(i˙˙˙˙N(tArg(t
ArgumentError(tFileTransferProgressBarMixin(t	S3Requestt	GetObjectc
BsqeZdZedddddddƒeddddd	ddd
dddƒgZd
„Zd„Zd„ZRS(s Retrieve objects from the servertsourcetmetavars
BUCKET/KEYtroute_tothelps!the object to download (required)s-otdesttPATHtdefaultt.sDwhere to download to.  If this names a
                directory the object will be written to a file inside of that
                directory.  If this is is "-" the object will be written to
                stdout.  Otherwise it will be written to a file with the name
                given.  (default:  current directory)cCs3tj|ƒ|jdjdƒ\}}}|sAtdƒ‚n|sVtdƒ‚nt|jjdƒtjƒr/|jddkršt	j
|jd<q/tjj
|jdƒrtjj|ƒ}|sÚtdƒ‚ntjj|jd|ƒ}t|dƒ|jd<q/t|jddƒ|jd<ndS(	NRt/s!source must contain a bucket namessource must contain a key nameR	t-sHspecify a complete file path with -o to download objects that end in '/'tw(Rt	configuretargst	partitionRt
isinstancetgettsixtstring_typestsyststdouttostpathtisdirtbasenametjointopen(tselftbuckett_tkeyRt	dest_path((sC/usr/lib/python2.7/site-packages/euca2ools/commands/s3/getobject.pyR2s 
cCs|jd|_dS(NR(RR(R((sC/usr/lib/python2.7/site-packages/euca2ools/commands/s3/getobject.pyt
preprocessIsc	CsF|jƒd}tjƒ}tjƒ}|jƒ}|jjdƒ}|rt|jd|jddt	|ƒƒ}n|jd|jdƒ}|j
ƒxw|jdtj
ƒD]`}|jdj|ƒ|t|ƒ7}|j|ƒ|j|ƒ|dk	r­|j|ƒq­q­W|jdjƒ|jƒ|ru|t	|ƒkru|jjd||ƒtd	j||ƒƒ‚n|jjd
dƒjƒjdƒ}t|ƒd
krtd„|Dƒƒr|jƒ|kr|jjd||jƒƒtdj||jƒƒƒ‚qnii|jƒd6|jƒd6|d6|jd6S(NisContent-LengthtlabelRtmaxvalt
chunk_sizeR	sQrejecting download due to Content-Length size mismatch (expected: %i, actual: %i)sGdownloaded file appears to be corrupt (expected size: {0}, actual: {1})tETagtt"i css|]}|dkVqdS(t0123456789abcdefN((t.0tchar((sC/usr/lib/python2.7/site-packages/euca2ools/commands/s3/getobject.pys	<genexpr>nssFrejecting download due to ETag MD5 mismatch (expected: %s, actual: %s)sFdownloaded file appears to be corrupt (expected MD5: {0}, actual: {1})tmd5tsha1tsize(R$thashlibR.R/tsendtheadersRtget_progressbarRtinttstarttiter_contentt	euca2oolstBUFSIZEtwritetlentupdatetNonetflushtfinishtlogterrortRuntimeErrortformattlowertstriptallt	hexdigest(	Rt
bytes_writtent
md5_digestt
sha_digesttresponsetcontent_lengthtpbartchunktetag((sC/usr/lib/python2.7/site-packages/euca2ools/commands/s3/getobject.pytmainLsH





	$	
N(	t__name__t
__module__tDESCRIPTIONRR=tARGSRR$RP(((sC/usr/lib/python2.7/site-packages/euca2ools/commands/s3/getobject.pyR's		(R1tos.pathRRtrequestbuilderRtrequestbuilder.exceptionsRtrequestbuilder.mixinsRRteuca2ools.commands.s3Rteuca2ools.bundle.pipesR8R(((sC/usr/lib/python2.7/site-packages/euca2ools/commands/s3/getobject.pyt<module>s
Back to Directory File Manager