Permalink
Browse files

Fixed an issue where additional whitespace was causing the Google aut…

…hentication to fail.
  • Loading branch information...
1 parent dacf6d1 commit d2dff6fb961be7d5e3af9a06d838d261e904c584 @jdmunro committed Aug 15, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 pyGTrends.py
View
@@ -51,6 +51,8 @@ def _connect(self):
galx = re.compile('<input type="hidden" name="GALX" value="(?P<galx>[a-zA-Z0-9_-]+)">')
resp = self.opener.open(self.url_ServiceLoginBoxAuth).read()
+ resp = re.sub(r'\s\s+', ' ', resp)
+
m = galx.search(resp)
if not m:
raise Exception("Cannot parse GALX out of login page")

3 comments on commit d2dff6f

After I add your fix, it moves to this next error.

Traceback (most recent call last):
File "test.py", line 5, in
print connector.csv()
File "pyGTrends.py", line 105, in csv
raise Exception("Could not find requested section")
Exception: Could not find requested section

If I check the output of self.raw_data I find
��You must be signed in to export data from Google Trends

update: The cause appears to be the use of google 2-step authentication. Disabled that and pyGTrends.py works.

This fix works for me. I was having the same error.

I'm getting the same error, even with the 2 step authentication disabled. "Could not find requested section"

Please sign in to comment.