login - Requests s.get(url,verify = False) error [Python] -
i'm attempting write program grabs data password protected gradebook , analyzes me because university's gradebook doesn't automatically calculate averages. i'm running issues @ beginning of program , it's growing more , more frustrating. i'm running on python 2.7.9.
this code.
import logging import requests import re url = "https://learn.ou.edu/d2l/m/login" s = requests.session() r = s.get(url,verify = false)
this error occurring.
traceback (most recent call last): file "/users/jackson/desktop/untitled folder/grade calculator.py", line 7, in <module> r = s.get(url,verify = false) file "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 473, in return self.request('get', url, **kwargs) file "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 461, in request resp = self.send(prep, **send_kwargs) file "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send r = adapter.send(request, **kwargs) file "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 431, in send raise sslerror(e, request=request) sslerror: eof occurred in violation of protocol (_ssl.c:581)
even weirder, happens gradebook url. when use different url such "http://login.live.com", error.
warning (from warnings module): file "/usr/local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 734 insecurerequestwarning) insecurerequestwarning: unverified https request being made. adding certificate verification advised. see: https://urllib3.readthedocs.org/en/latest/security.html
does know to fix issue? thanks, jackson.
requests not support need subclass httpadapter
from requests.adapters import httpadapter requests.packages.urllib3.poolmanager import poolmanager import ssl class myadapter(httpadapter): def init_poolmanager(self, connections, maxsize, block=false): self.poolmanager = poolmanager(num_pools=connections, maxsize=maxsize, block=block, ssl_version=ssl.protocol_tlsv1) import logging import requests import re url = "https://learn.ou.edu/d2l/m/login" s = requests.session() s.mount('https://', myadapter()) r = s.get(url,verify = false) print r.status_code
gives status code:
200
this answered here
Comments
Post a Comment