0

私は美しいスープを使用してリンクからデータを抽出しようとしています...現在、以下のような認証に失敗しています..リンクを認証するにはどうすればよいですか?ログインする必要があるサーバーを知っています..サーバーパスを提供する場所とリンクを検証する方法は?

from bs4 import BeautifulSoup as bs
import argparse
import urllib
import urllib2
import getpass
import re
import requests

def update (url):
    print url
    r = requests.get(url)
    html = r.text
    soup = bs(html)
def main ():
    #For logging
    print "test"
    parser = argparse.ArgumentParser(description='This is the update.py script created by test')
    parser.add_argument('-u','--url',action='store',dest='url',default=None,help='<Required> url link',required=True)
    results = parser.parse_args()# collect cmd line args
    url = results.url
    #print url
    update(url)
if __name__ == '__main__':
    main()

エラー:-

Traceback (most recent call last):
  File "announce_update2.py", line 24, in <module>
    main()
  File "announce_update2.py", line 22, in main
    update(url)
  File "announce_update2.py", line 11, in update
    r = requests.get(url)
  File "C:\Python27\lib\site-packages\requests-1.1.0-py2.7.egg\requests\api.py", line 55, in get
    return request('get', url, **kwargs)
  File "C:\Python27\lib\site-packages\requests-1.1.0-py2.7.egg\requests\api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Python27\lib\site-packages\requests-1.1.0-py2.7.egg\requests\sessions.py", line 289, in request
    history = [r for r in gen] if allow_redirects else []
  File "C:\Python27\lib\site-packages\requests-1.1.0-py2.7.egg\requests\sessions.py", line 133, in resolve_redirects
    proxies=proxies
  File "C:\Python27\lib\site-packages\requests-1.1.0-py2.7.egg\requests\sessions.py", line 279, in request
    resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
  File "C:\Python27\lib\site-packages\requests-1.1.0-py2.7.egg\requests\sessions.py", line 374, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python27\lib\site-packages\requests-1.1.0-py2.7.egg\requests\adapters.py", line 213, in send
    raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
4

0 に答える 0