I had to change this line to 'search_term = line.strip().replace(" ", "+")' to deal with any spaces in search terms (e.g. "Jennifer Lopez") - otherwise google would reject it as an invalid request (b/c it was an invalid url?).