SHARE
TWEET

Untitled

a guest Mar 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import boto3
  2. import zlib
  3. s3 = boto3.session.Session().client('s3')
  4. resp = s3.get_object( Bucket='BUCKET', Key='PATH' )
  5. b = resp['Body']
  6. i = 0
  7. cnt = 0
  8. c = 0
  9. dec = zlib.decompressobj(zlib.MAX_WBITS|32)
  10. for l in b.iter_chunks( chunk_size=1024 * 32 ):
  11.     c = dec.decompress( l ).decode().count( '\n' )
  12.     i+=1
  13.     cnt+=c
  14.  
  15. print( str( i ) + " : " + str( cnt ) )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top