<s> class Snipurl ( Service ) : <EOL> def __init__ ( self , user = None , apikey = None ) : <EOL> self . user = user <EOL> self . apikey = apikey <EOL> def _test ( self ) : <EOL> self . user = raw_input ( '<STR_LIT>' ) <EOL> self . apikey = raw_input ( '<STR_LIT>' ) <EOL> Service . _test ( self ) <EOL> def shrink ( self , bigurl , custom = None , title = None , private_key = None , <EOL> owner = None , include_private_key = False ) : <EOL> if self . user is None or self . apikey is None : <EOL> raise ShortyError ( '<STR_LIT>' ) <EOL> parameters = { <EOL> '<STR_LIT>' : bigurl , <EOL> '<STR_LIT>' : self . user , <EOL> '<STR_LIT>' : self . apikey , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> if custom : <EOL> parameters [ '<STR_LIT>' ] = custom <EOL> if title : <EOL> parameters [ '<STR_LIT>' ] = title <EOL> if private_key : <EOL> parameters [ '<STR_LIT>' ] = private_key <EOL> if owner : <EOL> parameters [ '<STR_LIT>' ] = owner <EOL> if include_private_key : <EOL> parameters [ '<STR_LIT>' ] = '<STR_LIT:Y>' <EOL> resp = request ( '<STR_LIT>' , <EOL> post_data = urlencode ( parameters ) ) <EOL> return resp . read ( ) <EOL> def expand ( self , tinyurl ) : <EOL> url = Service . expand ( self , tinyurl ) <EOL> if url . startswith ( '<STR_LIT:http>' ) : <EOL> return url <EOL> else : <EOL> raise ShortyError ( '<STR_LIT>' ) </s>
