<s> from urllib2 import urlopen , URLError , quote <EOL> from util import _fetch <EOL> from exceptions import ShowNotFound <EOL> BASE_URL = '<STR_LIT>' <EOL> def fetch ( show , exact = False , ep = None ) : <EOL> query_string = '<STR_LIT>' + quote ( show ) <EOL> if exact : <EOL> query_string = query_string + '<STR_LIT>' <EOL> if ep : <EOL> query_string = query_string + '<STR_LIT>' + quote ( ep ) <EOL> resp = _fetch ( BASE_URL + query_string ) . read ( ) <EOL> show_info = { } <EOL> if '<STR_LIT>' in resp : <EOL> raise ShowNotFound ( show ) <EOL> else : <EOL> data = resp . replace ( '<STR_LIT>' , '<STR_LIT>' ) . splitlines ( ) <EOL> for line in data : <EOL> k , v = line . split ( '<STR_LIT:@>' ) <EOL> show_info [ k ] = ( v . split ( '<STR_LIT>' ) if '<STR_LIT>' in v else <EOL> ( v . split ( '<STR_LIT>' ) if '<STR_LIT>' in v else v ) ) <EOL> return show_info </s>
