<s> """<STR_LIT>""" <EOL> import requests <EOL> import json <EOL> try : <EOL> import urlparse <EOL> except ImportError : <EOL> from urllib import parse as urlparse <EOL> from config import MailChimpConfig <EOL> config = MailChimpConfig ( ) <EOL> endpoint = urlparse . urljoin ( config . api_root , '<STR_LIT>' ) <EOL> params = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:count>' : <NUM_LIT:10> , '<STR_LIT>' : <NUM_LIT:0> <EOL> } <EOL> total_lists = <NUM_LIT:0> <EOL> while True : <EOL> response = requests . get ( endpoint , auth = ( '<STR_LIT>' , config . apikey ) , <EOL> params = params , verify = False ) <EOL> try : <EOL> response . raise_for_status ( ) <EOL> body = response . json ( ) <EOL> except requests . exceptions . HTTPError as err : <EOL> print "<STR_LIT>" . format ( str ( response . status_code ) , err ) <EOL> print json . dumps ( response . json ( ) , indent = <NUM_LIT:4> ) <EOL> break <EOL> except ValueError : <EOL> print "<STR_LIT>" % response . text <EOL> break <EOL> if len ( body [ '<STR_LIT>' ] ) == <NUM_LIT:0> : <EOL> break <EOL> total_lists += len ( body [ '<STR_LIT>' ] ) <EOL> for user_list in body [ '<STR_LIT>' ] : <EOL> print u'<STR_LIT>' % ( <EOL> user_list [ '<STR_LIT:id>' ] , <EOL> user_list [ '<STR_LIT:name>' ] , <EOL> user_list [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> params [ '<STR_LIT>' ] += params [ '<STR_LIT:count>' ] <EOL> print "<STR_LIT:\n>" + str ( total_lists ) + "<STR_LIT>" </s>
