import traceback
import copy
import operator
import codecs
import sys
import os
import searchconsole

#account = searchconsole.authenticate(client_config='c:/keys/service/client_secret.json',credentials='c:/keys/service/credentials.json')
account = searchconsole.authenticate(client_config='data/client_secret.json',credentials='data/credentials.json')

webproperty = account['https://hhh.com.tw/']


#report=webproperty.query.range('2021-01-01', '2020-01-02').dimension('page','query').get()
report=webproperty.query.range('2021-01-01', '2020-04-01').dimension('query').filter('query', '裝修設計', 'contains').get()
for r in report:
    print(r)
    print(r[1])
    print(r[4])

#    print(r['clicks'])
#    print(r['position'])

#for r in report.rows:
#    print(r)


