-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathget_gsc_properties.py
More file actions
32 lines (23 loc) · 924 Bytes
/
Copy pathget_gsc_properties.py
File metadata and controls
32 lines (23 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
'''
Retrieve a list of validated properties from Google Search Console.
@author: Jean-Christophe Chouinard.
@role: Sr. SEO Specialist at SEEK.com.au
@website: jcchouinard.com
@LinkedIn: linkedin.com/in/jeanchristophechouinard/
@Twitter: twitter.com/@ChouinardJC
Learn Python for SEO
jcchouinard.com/python-for-seo
Get API Keys
jcchouinard.com/how-to-get-google-search-console-api-keys/
How to format your request
jcchouinard.com/what-is-google-search-console-api/
'''
from oauth import authorize_creds, execute_request
creds = 'client_secrets.json'
webmasters_service = authorize_creds(creds)
site_list = webmasters_service.sites().list().execute()
# Filter for verified websites
verified_sites_urls = [s['siteUrl'] for s in site_list['siteEntry']
if s['permissionLevel'] != 'siteUnverifiedUser'
and s['siteUrl'][:4] == 'http']