title: ConnectionError: how to handle this error?
body: <p>I have got the following error:</p>
  <blockquote>
  <p>ProtocolError: ('Connection aborted.', OSError(0, 'Error'))</p>
  <p>During handling of the above exception, another exception occurred:</p>
  <p>ConnectionError                           Traceback (most recent call
  last)  in </p>
  <p>---&gt; 16 df['List'] = df['Link'].apply(get_all_links)</p>
  <p>/anaconda3/lib/python3.7/site-packages/pandas/core/series.py in
  apply(self, func, convert_dtype, args, **kwds)    4106<br />
  else:    4107                 values = self.astype(object)._values
  -&gt; 4108                 mapped = lib.map_infer(values, f, convert=convert_dtype)    4109     4110         if len(mapped) and
  isinstance(mapped[0], Series):</p>
  <p>pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()</p>
  <p> in get_all_links(url)
  7     # but that's outside the scope here
  8     print(url)
  ----&gt; 9     soup = BeautifulSoup(requests.get(url).content, &quot;html.parser&quot;)
  10
  11     return [a.attrs.get('href', '') for a in soup.find_all('a')]</p>
  <p>/anaconda3/lib/python3.7/site-packages/requests/api.py in get(url,
  params, **kwargs)
  74
  75     kwargs.setdefault('allow_redirects', True)
  ---&gt; 76     return request('get', url, params=params, **kwargs)
  77
  78</p>
  <p>ConnectionError: ('Connection aborted.', OSError(0, 'Error'))</p>
  </blockquote>
  <p>I would say that a <code>try/except</code> condition might fix the issue. Does anyone know how to fix it?</p>
  <pre><code>def get_all_links(url):
      soup = BeautifulSoup(requests.get(url).content, &quot;html.parser&quot;)
  
      return [a.attrs.get('href', '') for a in soup.find_all('a')]
  
  df['List'] = df['Link'].apply(get_all_links)
  </code></pre>
  <p>I think all the information are shared. The website that seems causing the issue should be 'https://www.puppetstringnews.com/'.</p>
  <p>An example of urls to test:</p>
  <pre><code>https://www.stackoverflow.com
  https://deepclips.com/
  https://www.puppetstringnews.com/
  </code></pre>