garc icon indicating copy to clipboard operation
garc copied to clipboard

List index out of range. Gab has changed something on their login page

Open paulfurber opened this issue 3 years ago • 3 comments

When running a simple query: garc userposts user

I now get an error:

Traceback (most recent call last): File "/home/maverick/.virtualenvs/garc2/bin/garc", line 8, in sys.exit(main()) File "/home/maverick/.virtualenvs/garc2/lib/python3.7/site-packages/garc/command.py", line 121, in main for thing in things: File "/home/maverick/.virtualenvs/garc2/lib/python3.7/site-packages/garc/client.py", line 173, in userposts account_id = self.get(account_url).json()['id'] File "/home/maverick/.virtualenvs/garc2/lib/python3.7/site-packages/garc/client.py", line 274, in get self.login() File "/home/maverick/.virtualenvs/garc2/lib/python3.7/site-packages/garc/client.py", line 229, in login token = page_info.select('meta[name=csrf-token]')[0]['content'] IndexError: list index out of range

paulfurber avatar Jul 14 '22 09:07 paulfurber

I dug into this and found that the error page is being brought up instead of the login page. Setting the User-Agent to a browser instead of 'garc' fixed it.

paulfurber avatar Jul 25 '22 14:07 paulfurber

Hi Paul, I am having this same issue but I am struggling to figure out how to set the user agent - do you mind sharing how you did that?

JeremyTuthill avatar Jul 25 '22 14:07 JeremyTuthill

Sure. In client.py line 353 the user_agent is set to 'garc'. I changed this line to read:

user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36'

paulfurber avatar Jul 25 '22 19:07 paulfurber