Giter Site home page Giter Site logo

googlesearchconsole-tutorial's People

Contributors

benbohmer avatar jcchouinard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

googlesearchconsole-tutorial's Issues

arg --noauth_local_webserver doesnt work...

First thanks for all the works, seems promising, when i will be ablle to connect to my Google search console API via your script (it work with https://developers.google.com/webmaster-tools/search-console-api-original/v3/quickstart/quickstart-python but as i need to run it via crontab on a GCP VM, it won't do it...
so, there is the issue : I run python on a remote virtual machine, and i need the token system from Oauth2 to aknoledge the use of my google account... I have to use the --noauth_local_webserver in order to bypass that...
but it dont seems to work though...
all requirement are ok i think (i follow your guide) but i still get the same output with or whitout the arg...
may be an issue with my oauth version? but it seems to be OK for me...
GSC1

googleapiclient.errors.UnknownApiNameOrVersion: name: webmasters version: v3

Hello,
Thank you very much for this script.
I had some issue with the connection to the service :
googleapiclient.errors.UnknownApiNameOrVersion: name: webmasters version: v3

I changed line 63 of oauth.py :
webmasters_service = build('webmaster', 'v3', http=http)
to :
webmasters_service = build('searchconsole', 'v1', http=http)
and it works now.
Greetings

KeyError: 'clicks'

gsc_to_csv gz: False
www_perfumesecompanhia_pt project exists
Checking CSVs in www_perfumesecompanhia_pt/
No CSV to read
Done extracting DF from CSVs
Start date at beginning: 2021-07-01 00:00:00
date = 2021-07-01
error occurred at 0

KeyError Traceback (most recent call last)
c:\ProgramData\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
3079 try:
-> 3080 return self._engine.get_loc(casted_key)
3081 except KeyError as err:

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'clicks'

The above exception was the direct cause of the following exception:

KeyError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_8836\905369252.py in
2
3 args = webmasters_service,site,output,creds,start_date
----> 4 gsc_to_csv(*args,end_date=end_date)

c:\Users\Gabriel\Desktop\GSC_TransferDataApp\gsc_to_csv_by_month.py in gsc_to_csv(webmasters_service, site, output, creds, start_date, end_date, gz)
111 # Add response to dataframe
112 df = pd.DataFrame(data = scDict)
--> 113 df['clicks'] = df['clicks'].astype('int')
114 df['ctr'] = df['ctr']*100
115 df['impressions'] = df['impressions'].astype('int')

c:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key)
3022 if self.columns.nlevels > 1:
3023 return self._getitem_multilevel(key)
-> 3024 indexer = self.columns.get_loc(key)
3025 if is_integer(indexer):
3026 indexer = [indexer]

c:\ProgramData\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
3080 return self._engine.get_loc(casted_key)
3081 except KeyError as err:
-> 3082 raise KeyError(key) from err
3083
3084 if tolerance is not None:

KeyError: 'clicks'

No data in rows when I try to extract Query by Page using the searchconsole API wrapper

Hi @jcchouinard

I tried your code on https://www.jcchouinard.com/searchconsole-api-wrapper-python/ to get Queries mapped to pages for my web property. However, I am not able to see any data in the rows.

`webproperty = account[site]
report = webproperty.query.range('today', days=-2).dimension('page', 'query').get()

print(report.rows)
print(report.columns)

df = report.to_dataframe()
df.head(5)`

I am not sure what is the issue. This is what I get in the terminal.

Screen Shot 2021-11-14 at 6 01 35 PM

Can you help me out?
I am relatively new to the world of coding. My hypothesis is that probably my site is not there in the list of sites under my GSC account. That is not the case in reality though.

Adding extra dimensions

Great job. I got it to work and I like how you renamed the keys. Is it possible to include 'device' and 'country' dimensions as well? I tried adding them to the gsc_with_filters.py but it doesn't seem to add the extra dimensions.

KeyError: 'clicks'

Hey I keep getting this error :
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/harry-d-luffy/Desktop/python/google search console api/GoogleSearchConsole-Tutorial/run_gsc.py", line 49, in
gsc_to_csv(*args)
File "/home/harry-d-luffy/Desktop/python/google search console api/GoogleSearchConsole-Tutorial/gsc_to_csv_by_month.py", line 113, in gsc_to_csv
df['clicks'] = df['clicks'].astype('int')
File "/usr/local/lib/python3.10/dist-packages/pandas/core/frame.py", line 3024, in getitem
indexer = self.columns.get_loc(key)
File "/usr/local/lib/python3.10/dist-packages/pandas/core/indexes/base.py", line 3082, in get_loc
raise KeyError(key) from err
KeyError: 'clicks'

Removing a repository from search index

Hello @jcchouinard @benbohmer ... Hope you guys are doing good... I need to stop an entire repo from being listed in google search index... is there any possible way to do this? I tried adding the repo to GSC's property, but it seems impossible.... Kindly help me on this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.