def main(): m = MovieSearchClient() search_by = input(("What do you want to search by ? [k]eyword /" "[d]irector / [i]mdb number. ")) if search_by == 'k': search = ask_for_searchword() resp = m.search_movie(search) prints_results(resp.json().get('hits')) elif search_by == 'd': search = ask_for_searchword() resp = m.search_director(search) prints_results(resp.json().get('hits')) elif search_by == 'i': search = ask_for_searchword() resp = m.search_imdb_number(search) result = resp.json() if result: print('{} by {} rate {}'.format(result.get('title'), result.get('director'), result.get('imdb_score'))) else: print('No results founds') else: print('Invalid option')
def main(): val = input('To search by keyword enter 1, director enter 2, ' 'or IMDB code enter 3. To exit enter anything else: ') svc = MovieSearchClient() if val == '1': search = input('Enter a keyword: ') response = svc.search_keyword(search) results = response.json() for idx, item in enumerate(results['hits'], 1): print(f'{idx}. {item.get("title")}') elif val == '2': search = input('Enter a director: ') response = svc.search_director(search) results = response.json() for idx, item in enumerate(results['hits'], 1): print(f'{idx}. {item.get("title")}') elif val == '3': search = input('Enter a IMDB code: ') response = svc.search_imdb_code(search) results = response.json() print(results.get('title')) else: print('Goodbye!')
def read_post(): keyword = input('What do you want to search by: ') svc = MovieSearchClient() response = svc.entries_by_search(keyword) posts = response.json() print(posts)
def main(): val = 'Nul' while val: print("What would you like to do next?") val = input('Search movies by: [k]eyword, [d]irector, [i]mdb code?') if val == 'k': read_post() elif val == 'd': MovieSearchClient.entries_by_director() elif val == 'i': MovieSearchClient.entry_by_imdbcode()
def search_movies_by_imdb_code(imdb_code): msc = MovieSearchClient() resp = msc.get_movies_by_imdb_code(imdb_code) result = resp.json() return result
def search_movies_by_director(director_name): msc = MovieSearchClient() resp = msc.get_movies_by_director(director_name) results = resp.json() return results
def search_movies(movie_title): msc = MovieSearchClient() resp = msc.get_movies(movie_title) results = resp.json() return results