hhh_lib.py 774 B

12345678910111213141516171819202122232425262728
  1. import traceback
  2. import copy
  3. import operator
  4. import codecs
  5. import sys
  6. import os
  7. import searchconsole
  8. #account = searchconsole.authenticate(client_config='c:/keys/service/client_secret.json',credentials='c:/keys/service/credentials.json')
  9. account = searchconsole.authenticate(client_config='data/client_secret.json',credentials='data/credentials.json')
  10. webproperty = account['https://hhh.com.tw/']
  11. #report=webproperty.query.range('2021-01-01', '2020-01-02').dimension('page','query').get()
  12. report=webproperty.query.range('2021-01-01', '2020-04-01').dimension('query').filter('query', '裝修設計', 'contains').get()
  13. for r in report:
  14. print(r)
  15. print(r[1])
  16. print(r[4])
  17. # print(r['clicks'])
  18. # print(r['position'])
  19. #for r in report.rows:
  20. # print(r)