Skip to content
This repository was archived by the owner on Dec 9, 2018. It is now read-only.

follow redirects? #73

Open
rotten opened this issue Feb 9, 2017 · 0 comments
Open

follow redirects? #73

rotten opened this issue Feb 9, 2017 · 0 comments

Comments

@rotten
Copy link

rotten commented Feb 9, 2017

I am getting this exception when I try to hit a particular web page:

>>> import dryscrape
>>> weburl = _someurl_
>>> websession = dryscrape.Session(base_url = weburl)
>>> websession.visit('/')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/dryscrape/session.py", line 33, in visit
    return self.driver.visit(self.complete_url(url))
  File "/usr/local/lib/python3.6/site-packages/webkit_server.py", line 235, in visit
    self.conn.issue_command("Visit", url)
  File "/usr/local/lib/python3.6/site-packages/webkit_server.py", line 520, in issue_command
    return self._read_response()
  File "/usr/local/lib/python3.6/site-packages/webkit_server.py", line 530, in _read_response
    raise InvalidResponseError(msg)
webkit_server.InvalidResponseError: {"class":"InvalidResponseError","message":"Unable to load URL: http://_someurl_/ because of error loading http:/activityi;src=4371413;type=conve0;cat=merce001;ord=3665093008894.473?: Unknown error"}

I can hit someurl just fine with my browser. Looking closer (using httpie), I see that it does a 301 redirect, which my browser handles no problem.

So I thought this might be a case where dryscrape doesn't follow redirects, but now I'm not so sure. I put in the url we get redirected to, and it still throws the above error.

When I connect to the redirected url with httpie, it has no problem and it looks like I get back a 200 and lots of page content.

The javascript console for the page (as observed in Chrome) doesn't have any errors that seem likely to be causing dryscrape to fail. The only error that pops up there is this:

XMLHttpRequest cannot load data:text;charset=utf-8,. The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. Origin 'null' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

This is a public site that does not require authentication.

Suggestions of where to look next? I'm willing to share the url offline.

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

1 participant