serpapi / serpapi-python

an official Python client library for SerpApi.
https://pypi.org/project/serpapi/
MIT License
46 stars 4 forks source link

Update your python sdk to work with python version higher than 3.7 #14

Closed Marcus-Peterson closed 4 months ago

Marcus-Peterson commented 4 months ago

Fortunately for me, another project requires that i use 3.7 so it works fine there. But another project requires that I use 3.9, so stuff like GoogleSearch(params) doesnt work now. Update it thank you

I get these errors all the time now: ImportError: cannot import name 'GoogleSearch' from 'serpapi'

Freaky commented 4 months ago

Hi Marcus, thanks for reporting this.

I believe you're looking for our older google-search-results library. Both it and this newer serpapi library have the same module name for imports, but different interfaces, so they're very easily confused. We'll look into providing better error messages for this.

If you'd like to try using this library instead of google-search-results, its interface looks like this:

import os
import serpapi

client = serpapi.Client(api_key=os.getenv("API_KEY"))
results = client.search(engine='google', q='coffee')

Further details can be found in the README.

Either client should work fine in Python 3.9 and beyond, regardless of which you choose to use going forward.

I hope that helps, and I'm sorry for the confusion.

Marcus-Peterson commented 4 months ago

Okay thanks, I'll look into this