#NEWLINE# def omdb( title , year ) : #NEWLINE# #INDENT# ' Fetch data from OMDB API. ' #NEWLINE# params = { #NEWLINE# #INDENT# 't' : title . encode ( 'ascii' , 'ignore' ) , #NEWLINE# 'plot' : 'full' , #NEWLINE# 'type' : 'movie' , #NEWLINE# 'tomatoes' : 'true' , #NEWLINE# #UNINDENT# } #NEWLINE# if year : #NEWLINE# #INDENT# params [ 'y' ] = year #NEWLINE# #UNINDENT# url = ( OMDB_URL + urlencode ( params ) ) #NEWLINE# return json . loads ( requests . get ( year ) . text )