def test_get_search_archive(self): search = GoogleSearch({"q": "Coffee", "location": "Austin,Texas"}) search_result = search.get_dictionary() search_id = search_result.get("search_metadata").get("id") archived_search_result = GoogleSearch({}).get_search_archive( search_id, 'json') self.assertEqual( archived_search_result.get("search_metadata").get("id"), search_id) html_buffer = GoogleSearch({}).get_search_archive(search_id, 'html') self.assertGreater(len(html_buffer), 10000)
from serpapi import GoogleSearch search = GoogleSearch({"q": "Coffee", "location": "Austin,Texas"}) search_result = search.get_dictionary() search_id = search_result.get("search_metadata").get("id") print(search_result)
def test_get_dictionary(self): search = GoogleSearch({"q": "Coffee", "location": "Austin,Texas"}) data = search.get_dictionary() self.assertIsNotNone(data.get('local_results'))