google-searchconsole icon indicating copy to clipboard operation
google-searchconsole copied to clipboard

Add support for new API

Open antoineeripret opened this issue 3 years ago • 4 comments

Hey @joshcarty,

Google announced a new API for GSC: https://developers.google.com/search/blog/2022/01/url-inspection-api. Do you want to extend your package to support it or do you rather stick to performance reporting only?

Just asking before starting to work on it, because the structure is pretty different :)

Thanks!

antoineeripret avatar Jan 31 '22 11:01 antoineeripret

Hey @joshcarty:

I don't know if you are interested in the new functionality I've mentioned some months ago or if you have time at the moment. I think it could enhance your library, though.

I've started to look into the logic, and with a simple new class , we could extract the information we need:

class IndexInspect:  
  def get(self,urls):
    results = []
    for url in urls:
      request = {
          'siteUrl': domain,
          'inspectionUrl': url
      }
      results.append(account.service.urlInspection().index().inspect(body=request).execute())
    
    return results

In its current state, the code would output the following, but the idea is obviously to add a to_dataframe() method, as you did for the query class.

image

Should I make a PR adding this new class (and other relevant code) to allow you library to handle this new API functionality?

antoineeripret avatar Aug 16 '22 12:08 antoineeripret

Thanks for this @antoineeripret - I'll review your PR this week!

joshcarty avatar Aug 17 '22 08:08 joshcarty

It sounds like this was never implemented?

Taking a chance to "promote" the integration into my library. https://github.com/andreamoro/GSC-Wrapper/tree/URL-Inspection-Integration

The query part is major refactoring from Josh's original work.

@antoineeripret happy to hear your comments.

andreamoro avatar Dec 03 '23 17:12 andreamoro

Hi @andreamoro, I'll have a look if I have a moment this week (two bank holidays in Spain). Thanks for the heads-up!

antoineeripret avatar Dec 04 '23 12:12 antoineeripret