def main(location): """A command line tool to get the info on all the latest movies. ex: flix New """ ## locations with more than one word, ie. new york if (len(location) > 0): string = "" for arg in location: string += arg + "+" string = string[:-1] else: string = "" parser = GoogleMovieShowtimes(string,"","") database = parser.parse() data = database['theater'] theater = data[0] theater_name = theater['name'] click.echo("") click.echo('{0}:'.format(theater_name)) movies = theater['movies'] for titles in movies: movie_name = titles['name'] click.echo("") click.echo('{0}'.format(movie_name)) movie_times = "" for movie_info in titles['times']: if len(movie_info) < 2: continue movie_times += str(movie_info) + " | " click.echo('{0}'.format(movie_times[:-2]))
def hello_world(): if request.method == 'GET': postal_code = request.cookies.get('postal_code') return render_template('first_page.html', postal_code=postal_code) elif request.method == 'POST': postal_code = request.form.get('postal_code') theater = request.form.get('Theater') if postal_code and theater: movie = GoogleMovieShowtimes(postal_code, '', theater, app.logger) theaters = movie.parse() cinemas = theaters.get('theater') cinema = cinemas[0] movies = cinema.get('movies') ret = make_response(render_template('movie_list.html', movies=movies)) ret.set_cookie('postal_code', postal_code) return ret else: return redirect('/')