Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

SitesFeedSummary example doesn't work #31

Open
sallyruthstruik opened this issue Jul 28, 2015 · 1 comment
Open

SitesFeedSummary example doesn't work #31

sallyruthstruik opened this issue Jul 28, 2015 · 1 comment

Comments

@sallyruthstruik
Copy link

Here is output:

/home/stas/env/wmt_scrapper/bin/python /home/stas/PycharmProjects/wmt_scrapper/gdata-python-client/samples/webmastertools/SitesFeedSummary.py
Please enter your username: ****
/usr/lib/python2.7/getpass.py:83: GetPassWarning: Can not control echo on the terminal.
  passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Password: ****

Logging in
Retrieving Sites feed
Traceback (most recent call last):
  File "/home/stas/PycharmProjects/wmt_scrapper/gdata-python-client/samples/webmastertools/SitesFeedSummary.py", line 42, in <module>
    feed = client.GetSitesFeed()
  File "/home/stas/env/wmt_scrapper/local/lib/python2.7/site-packages/gdata/webmastertools/service.py", line 85, in GetSitesFeed
    return self.Get(uri, converter=converter)
  File "/home/stas/env/wmt_scrapper/local/lib/python2.7/site-packages/gdata/service.py", line 1107, in Get
    'reason': server_response.reason, 'body': result_body}
gdata.service.RequestError: {'status': 401, 'body': '<HTML>\n<HEAD>\n<TITLE>Authorization required</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Authorization required</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': 'Authorization required'}

Also, when I try to use oauth authentication I also get's error:

#-*- coding: utf-8 -*-
from wmt_scrapper.google_api import GoogleApi

__author__ = 'stas'

import gdata.webmastertools.service

client = gdata.webmastertools.service.GWebmasterToolsService()

def request(*a, **k):
    stream = client.request(*a, **k)
    out = stream.read()
    stream.close()

    return out

gapi = GoogleApi()

gapi.credentials.authorize(client)

print request('GET', "https://www.google.com/webmasters/tools/gwt/SITE_LIST?hl=en&authuser=1")

returns

Traceback (most recent call last):
  File "/home/stas/PycharmProjects/wmt_scrapper/gwtd/test.py", line 21, in <module>
    print request('GET', "https://www.google.com/webmasters/tools/gwt/SITE_LIST?hl=en&authuser=1")
  File "/home/stas/PycharmProjects/wmt_scrapper/gwtd/test.py", line 11, in request
    stream = client.request(*a, **k)
  File "/home/stas/env/wmt_scrapper/local/lib/python2.7/site-packages/oauth2client/client.py", line 562, in new_request
    redirections, connection_type)
  File "/home/stas/env/wmt_scrapper/local/lib/python2.7/site-packages/atom/__init__.py", line 92, in optional_warn_function
    return f(*args, **kwargs)
TypeError: request() takes at most 6 arguments (7 given)
@ryeager315
Copy link

I am getting the same error...exactly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants