Skip to content

Commit

Permalink
Update headline.py
Browse files Browse the repository at this point in the history
Removed urrlib connection check and unused libraries
  • Loading branch information
mandjevant authored Sep 1, 2019
1 parent b6f5f41 commit 9597b6b
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions modules/headline.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import newspaper
import nltk
from nltk.classify import NaiveBayesClassifier
from nltk.classify.util import accuracy
import urllib.request
import sys


class title:
Expand All @@ -13,13 +10,7 @@ def __init__(self):
self.pos=[] #Variable to store all positive tokens from positive_headlines.csv file
self.neg=[] #Variable to store all negative tokens from negative_headlines.csv file

try:
self.news_page=urllib.request.urlopen(self.news_url)

except urllib.error.URLError:
print("\nCONNECTIION ERROR:There may be a connection problem. Please check if the device is connected to the Internet")
sys.exit()

# extract headline
def extract_headline(self):
try:
Expand Down Expand Up @@ -64,4 +55,4 @@ def main(self):

if __name__=='__main__':
title().main()


0 comments on commit 9597b6b

Please sign in to comment.