def search_event_loop():
    search = None
    while search != 'x':
        try:
            search = input('Move search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print('Found {} results'.format(len(results)))
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
        except requests.exceptions.ConnectionError:
            print('Internet unavailable, please try again later.')
        except ValueError:
            print('Search text is required.')
        print()
Example #2
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} results.".format(len(results)))
                for r in results:
                    print('{} --- {}'.format(r.year, r.title))
        except requests.ConnectionError:
            print("Error... you're network might be down.")
        except ValueError:
            print("Error: Search text is required.")
        except Exception as x:
            print("Unexpected error. Details: {}".format(type(x)))
    print('Exiting...')
Example #3
0
def search_event_loop():
    search = "ONCE_THROUGH_LOOP"
    while search != "x":
        try:
            search = input("Movie search text (x to exit): ")
            if search != "x":
                results = movie_svc.find_movies(search)
                print("Found {} result.".format(len(results)))
                for r in results:
                    print("{} -- {}".format(r.year, r.title))
                print()
        except ValueError as ce:
            print("ValueError due to \n{}.....!".format(type(ce)))
        except requests.exceptions as ce:
            print("Network Error due to \n{}.....!".format(type(ce)))
        except Exception as x:
            print("Error due to {}.....!".format(x))

    print("Exiting .... ... ... .")
Example #4
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':  # Tee etsintää niin kauan kunnes käyttäjä painaa 'x' eli exit.
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} results.".format(len(results)))
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
                print()
        except requests.exceptions.ConnectionError as ce:
            print("Error, your network is down! Details: {}".format(ce))
        except ValueError as ve:
            print("Error, search text is required! Details: {}".format(ve))
        except Exception as x:
            print("Unexpected error. Details: {}".format(x))
    print('exiting...')
Example #5
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'
    while search != 'x':
        try:
            search = input('Movie search text (x to exit): \n')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print(f'Found {len(results)}')
                for r in results:
                    print(f'{r.year} ---  {r.title}')

        except ValueError:
            print(f'Error: Search text is required.')
        except ConnectionError:
            print(f'Error: Your network is down.')
        except Exception as x:
            print(f'Unexpected error. Details: {x}')

    print('Exiting...')
Example #6
0
def search_event_loop():
    search = "ONCE_THROUGH_LOOP"

    while search != "x":
        try:
            search = input("Movie search text (x to exit): ")
            if search != "x":
                results = movie_svc.find_movies(search)
                print("Found {} results.".format(len(results)))
                for r in results:
                    print("{} -- {}".format(
                        r.year, r.title
                    ))
                print()
        except ValueError:
            print("Error: Search text is required")
        except Exception as requests.exceptions.ConnectionError as ce:
            print("Error: Your network is down.")
        except Exception as x:
            print("Unexpected error. Details: {}".format(x))
def search_event_loop():
    search = "ONCE_THROUGH_LOOP"

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print(f'Found {len(results)}')
                for r in results:
                    print(f'{r.year} -- {r.title}')
                print()
        except ValueError:
            print("Error: Search text is required")
        except requests.exceptions.ConnectionError:
            print("Error your network is down.")
        except Exception as x:
            print(f"YIKES, that didn't work! Details: {x}")

    print('exiting...')
Example #8
0
def search_event_loop():

    search = 'ONCE THROUGH LOOP'
    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} movies searching for '{}'".format(
                    len(results), search))
                for r in results:
                    print("{} -- {}".format(r.year, r.title))
        except ValueError as ve:
            print('Error: {}'.format(ve))
        except requests.exceptions.ConnectionError as ce:
            print('Error: Your network is down: details: {}'.format(ce))
        except Exception as x:
            print('Unexpected Error: {}'.format(x))

    print('Exiting . . .')
Example #9
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':  # zolang we geen x ingeven blijft de app draaien
        try:  # door de try proberen we het, gaat het niet dat gaan we naar exception. er kunnen zelfs specifieke exceptions aangeroepen worden. en daarna gaan we terug de while loop in. ipv dat de app crashed
            search = input(
                "What movie do you want to search for? (x to exit): ")
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} movies results".format(len(results)))
                for r in results:
                    print("{} -- {}".format(r.year, r.title))
                print()
        except ValueError:  # deze exception wordt aangeroepen in de movie_svc routine als er geen tekst is ingegeven.
            print("Error: Search text is required")
        except requests.exceptions.ConnectionError:  # deze exception wordt gezet als er netwerk problemen zijn. we controleren of de type of exception
            print("Error: Your network is down")
        except Exception as x:  # nu wordt de rede van de exception mee gegeven als x, en deze wordt vervolgens geprint is de onderstaande print opdracht.
            print("Unexpected error! Details: {}".format(x))
    print('exiting...')
Example #10
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while (search != 'x'):
        try:
            search = input('Movie search text (x to exit): ')
            if (search != 'x'):
                results = movie_svc.find_movies(search)
                print('Found {} results.'.format(len(results)))
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
                print()
        except ValueError:
            print('Error: Search text is required.')
        except requests.exceptions.ConnectionError:
            print('Error: your network is down.')
        except Exception as x:
            print('Unexpected error. Details: {}'.format(x))

    print('exiting ...')
Example #11
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} results".format(len(results)))
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
                print()
        except ValueError:
            print("Error: Search text is required.")
        except requests.exceptions.ConnectionError:
            print("Error: Could not find a network connection.")
        except Exception as x:
            print("Unexpected Error! Details: {}".format(x))

    print('exiting...')
def search_event_loop():
    search = "ONCE_THROUGH_LOOP"
    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ').rstrip().lower()
            if search != 'x':
                results = movie_svc.find_movies(search)
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
                print()
        except ValueError:
            print('Error: search text is required')
        except requests.exceptions.ConnectionError:
            print('Error: Please check network connection.')
        except Exception as x:
            print('Error: unable to run search at this time!')
            # to see type of exception
            #print('Details: {}'.format(type(x)))
            print('Details: {}'.format(x))

    print('Exiting .....')
Example #13
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} results.".format(len(results)))
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
                print()
        except ValueError:
            print("Error: Search text is required")
        except requests.exceptions.ConnectionError:
            print("Houston, we have a problem.\n"
                  "Looks like your network is down!")
        except Exception as x:
            print("Unexpected error! Details: {}".format(x))

    print('Exiting...')
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':
        try:
            print()
            search = input("Enter keyword for movie search ('x' to exit): ")
            print()
            if search != 'x':
                result = movie_svc.find_movies(search)
                print("Found {} results.".format(len(result)))
                for r in result:
                    print("{} - {}".format(r.year, r.title))
        except ValueError:  # possible since we raised/defined an ValueError in 'movie_svc'
            print("Error: Search text is required")
        except requests.exceptions.ConnectionError:
            print("Error: Your network is down")
        except Exception as x:
            print("Unexpected error. Details: {}".format(x))

    print('exiting...')
Example #15
0
def search_event_loop():
    search = 'SEARCH_EVENT_LOOP'

    while search != 'x':
        try:  # try to process code in block, if something goes wrong, raise exception
            search = input("Movie search text (x to exit): ")
            if search != 'x':
                result = movie_svc.find_movies(search)
                print("Found {} movies for search {}:".format(
                    len(result), search))
                for r in result:
                    print("{} - {}".format(r.year, r.title))
                print()
        except ValueError:  # catches valueError  from find_movies function
            print("Error: Search text is required.")
        except requests.exceptions.ConnectionError:
            print("Error: Your network is down.")
        except Exception as x:  # general exception
            print("Unexpected error. Details: {}".format(x))

    print('exiting...')
Example #16
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} results.".format(len(results)))
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
                print()
        # python looks at errors from top to bottom and executes the first match
        except ValueError as ve:
            print(ve)
        except requests.exceptions.ConnectionError:
            print("Error: Your network is down.")
        except Exception as x:
            print("Unexpected error. Details: {}".format(x))

    print('exiting...')
def search_request_loop():
    search = 'ONE-TIME-LOOP'

    while search != 'x':
        try:
            search = input('What movie do you want to search for?(x to exit) ')
            if search != 'x':
                results = movie_svc.find_movies(search)

                print('Found {} results'.format(len(results)))
                for r in results:
                    print('{} - {}'.format(r.year, r.title))
                print()

        except requests.exceptions.ConnectionError:
            print("Error! Your network is down!")
        except ValueError as error:
            print(error)
        except Exception as x:
            print('Unexpected error. Details:\n{}'.format(x))

    print('Exiting...')
Example #18
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} results.".format(len(results)))
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
                print()
        except ValueError:
            print("Error: Search text is required.")
        except requests.exceptions.ConnectionError:
            print("Error: Your network is down.")
        except Exception as x:
            print(
                "Unexpected error. Please share these details with Support: {}"
                .format(x))

    print('exiting...')
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} results.".format(len(results)))
                for r in results:
                    print('{} -- {}'.format(
                        r.year, r.title
                    ))
                print()
        except ValueError:
            print("Error: Search text is required")
        except requests.exceptions.ConnectionError:
            print("Error: Your network is down.")
        except Exception as x:
            print("Unexpected error. Details: {}".format(x))

    print('exiting...')
Example #20
0
def search_event_loop():
    search = 'ONCE_THROUGH_LOOP'

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print(f"Found {len(results)} results.")
                for r in results:
                    print(f'{r.year} -- {r.title}')
                print()
        except ValueError as ve:
            print(ve)
        except requests.exceptions.ConnectionError as ce:
            print('Error: your network is down.')
            break
        except Exception as x:
            print(f"Unexpected error. Details: {x}")
            break

    print('exiting...')
Example #21
0
def search_event_loop():
    search = 'capital'

    while search != 'x':
        try:
            search = input('Movie search text (x to exit): ')
            if search != 'x':
                results = movie_svc.find_movies(search)
                print("Found {} movies".format(len(results)))
                for r in results:
                    print('{} -- {}'.format(r.year, r.title))
                print()

        except ValueError:
            print('Error: Search text is required.')
        except requests.exceptions.ConnectionError:
            print('Error: Connection Error')
        except requests.exceptions.ConnectTimeout:
            print('Error: Connection Timedout')
        except Exception as e:
            print('Error: '.format(e))

    print('Exiting... ')
Example #22
0
def search_event_loop():
    search_text = 'ONCE_THROUGH_LOOP'

    while search_text != 'x':
        try:
            search_text = input('Movie search text (x to exit): ').lower()
            if search_text != 'x':
                results = movie_svc.find_movies(search_text)
                print('Found {} movies for search {}.'.format(
                    len(results), search_text))
                for r in results:
                    print("{} -- {}".format(r.year, r.title))
                print()
        except ValueError as ve:
            print(ve)
        except requests.exceptions.ConnectionError:
            print('Error: Your network is down. Please check your connection.')
        except requests.exceptions.HTTPError:
            print('Error: Content not found. Enter valid search phrase.')
        except Exception as x:
            print('Unexpected error. Details: {}. Error type: {}'.format(
                type(x), x))

    print('Exiting...')