title: Scraping links from html using beautifulsoup parts
body: <p>I am doing Python for everybody specialization from Coursera the book contains this code which I can't understand properly.</p>
  <pre><code># To run this, download the BeautifulSoup zip file
  # http://www.py4e.com/code3/bs4.zip
  # and unzip it in the same directory as this file
  
  from urllib.request import urlopen
  from bs4 import BeautifulSoup
  import ssl
  
  # Ignore SSL certificate errors
  ctx = ssl.create_default_context()
  ctx.check_hostname = False
  ctx.verify_mode = ssl.CERT_NONE
  
  url = input('Enter - ')
  html = urlopen(url, context=ctx).read()
  soup = BeautifulSoup(html, &quot;html.parser&quot;)
  
  # Retrieve all of the anchor tags
  tags = soup('a')
  for tag in tags:
      # Look at the parts of a tag
      print('TAG:', tag)
      print('URL:', tag.get('a', None))
      print('Contents:', tag.contents[0])
      print('Attrs:', tag.attrs)
  </code></pre>
  <p>first of all, can someone explain to me this portion of code?</p>
  <pre><code>ctx = ssl.create_default_context()
  ctx.check_hostname = False
  ctx.verify_mode = ssl.CERT_NONE
  </code></pre>
  <p>what exactly is happening here and how it is ignoring SSL errors.
  What exactly is happening in this line.</p>
  <pre><code>html = urlopen(url, context=ctx).read() #I know about the urlopen what exactly this context=ctx doing here
  </code></pre>
  <p>Third thing</p>
  <pre><code>print('URL:', tag.get('a', None))
      print('Contents:', tag.contents[0]) #how exactly this content is working and why [0]
      print('Attrs:', tag.attrs)# what are the Attrs:
  </code></pre>