title: Returning None in flask, but I don't understand why
body: <p>I've been trying to build a web scraper to help me keep up with articles published in my industry.</p>
  
  <p>I'm at my wits end, because when I try to run my code through Flask, I keep getting this error:</p>
  
  <p>TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.</p>
  
  <p>Here is the code producing the error:</p>
  
  <p>Doc 1 is blogscraper.py and it reads:</p>
  
  <pre><code>import requests
  from bs4 import BeautifulSoup
  
  
  def blog_parser(url) -&gt; 'html':
      import requests
      headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
      result = requests.get(url, headers=headers)
      return result.content
  
  
  def html(url) -&gt; 'html':
      website = blog_parser(url)
      html = BeautifulSoup(website, 'html.parser')
      return html
  
  def site_articles(url, element, unique_element) -&gt; 'html':
      sitehtml = html(url)
      article_data = sitehtml.find_all(element, unique_element)
      return article_data
  
  def skillsoft_titles(list_item):
      skillsoft_articles = site_articles('https://www.skillsoft.com/blog', "h1", {"class": "entry-title"})
      entries = skillsoft_articles[list_item]
      title = entries.find('a').get_text()
      return title
  
  def skillsoft_link(list_item):
      skillsoft_articles = site_articles('https://www.skillsoft.com/blog', "h1", {"class": "entry-title"})
      entries = skillsoft_articles[list_item]
      link = entries.find('a').get('href')
      return link
  
  def skillsoft_description(list_item):
      skillsoft_articles = site_articles('https://www.skillsoft.com/blog', "div", {"class": "entry-content"})
      entries = skillsoft_articles[list_item]
      description = entries.select_one("div p:nth-of-type(2)").text
      return description
  
  def opensesame_titles(list_item) -&gt; str:
      opensesame_articles = site_articles('https://www.opensesame.com/site/blog/', "div", {"class": "blog-post-right"})
      entries = opensesame_articles[list_item]
      title = entries.find('a').get_text()
      return title
  
  def opensesame_link(list_item) -&gt; str:
      opensesame_articles = site_articles('https://www.opensesame.com/site/blog/', "div", {"class": "blog-post-right"})
      entries = opensesame_articles[list_item]
      link = entries.find('a').get('href')
      return link
  
  def opensesame_description(list_item):
      opensesame_articles = site_articles('https://www.opensesame.com/site/blog/', "section", {"class": "entry-content"})
      entries = opensesame_articles[list_item]
      description = entries.find('p').text
      return description
  
  def cornerstone_titles(list_item) -&gt; str:
      cornerstone_articles = site_articles('https://www.cornerstoneondemand.com/rework', "h2", {"class": "text-blue"})
      entries = cornerstone_articles[list_item]
      title = entries.find('a').get_text()
      return title
  
  def cornerstone_link(list_item) -&gt; str:
      cornerstone_articles = site_articles('https://www.cornerstoneondemand.com/rework', "h2", {"class": "text-blue"})
      entries = cornerstone_articles[list_item]
      link = entries.find('a').get('href')
      return link
  
  def cornerstone_description(list_item) -&gt; str:
      cornerstone_articles = site_articles('https://www.cornerstoneondemand.com/rework', "div", {"class": "col3-teaser-cont"})
      entries = cornerstone_articles[list_item]
      description = entries.find('p').text
      return description
  
  
  def print_values(list_item, title_func, link_func, desc_func):
      return (print('Title:', title_func(list_item), '\n' 'Link:', link_func(list_item), '\n' 'Description:', desc_func(list_item)))
  
  </code></pre>
  
  <p>This works fine on it's own, within pycharm it returns exactly what I want it to.</p>
  
  <p>Doc 2 is my flask doc, and the code is:</p>
  
  <pre><code>import blogscraper
  from flask import Flask
  
  app = Flask(__name__)
  
  skillsoft_titles = blogscraper.skillsoft_titles
  skillsoft_link = blogscraper.skillsoft_link
  
  skillsoft_description = blogscraper.skillsoft_description
  
  @app.route('/', methods = ['GET'])
  
  
  
  def skillsoft():
      output = blogscraper.print_values(1, skillsoft_titles, skillsoft_link, skillsoft_description)
      return output
  
  skillsoft()
  
  app.debug = True
  app.run()
  app.run(debug = True)
  
  </code></pre>
  
  <p>This produces the error. For some reason, this produces a None or no return, which doesn't make sense to me after googling the none returns. Any help on this is much appreciated!</p>