<s> import sys <EOL> import os <EOL> import argparse <EOL> import requests <EOL> import l8_lib <EOL> def build_url ( scene_root ) : <EOL> sensor , path , row = l8_lib . parse_scene ( scene_root ) <EOL> assert sensor == '<STR_LIT>' <EOL> return '<STR_LIT>' % ( <EOL> '<STR_LIT>' , <EOL> path , <EOL> row , <EOL> scene_root ) <EOL> def pull ( scene_root , scene_dict , verbose = False ) : <EOL> filename = scene_root + '<STR_LIT>' <EOL> url = build_url ( scene_root ) <EOL> if verbose : <EOL> print '<STR_LIT>' , url <EOL> rv = requests . get ( url , stream = True ) <EOL> rv . raise_for_status ( ) <EOL> with open ( filename , '<STR_LIT:wb>' ) as f : <EOL> for d in rv . iter_content ( chunk_size = <NUM_LIT> * <NUM_LIT> * <NUM_LIT:10> ) : <EOL> if d : <EOL> f . write ( d ) <EOL> if verbose : <EOL> sys . stdout . write ( '<STR_LIT:.>' ) <EOL> sys . stdout . flush ( ) <EOL> if verbose : <EOL> sys . stdout . write ( '<STR_LIT:\n>' ) <EOL> if open ( filename ) . read ( <NUM_LIT:2> ) != '<STR_LIT>' : <EOL> raise Exception ( '<STR_LIT>' % filename ) <EOL> if verbose : <EOL> print '<STR_LIT>' % ( <EOL> filename , os . path . getsize ( filename ) ) <EOL> return filename </s>
