abenassi / Google-Search-API

Python based api for searching google web, images, calc, and currency conversion.
552 stars 218 forks source link

Add time parameter to search query #57

Closed anath2 closed 6 years ago

JuaniFilardo commented 6 years ago

Awesome. But before merging, could you change the line if time_period: to if time_period in time_mapping:?

This way we do the same as in your line, plus checking if the key is in the list, in order not to raise a KeyError if someone sets time_period='potato' or something similar.

Note: this work perfectly unless someone weirdly decides to add a False key to the time_mapping array. If you wanna be really sure, and I think this would be a nicer way, the condition should be

if time_period and time_period in time_mapping:

Thanks!