Commit a8e6608d authored by Landon DeCoito's avatar Landon DeCoito

Merge branch 'Landon' into 'master'

Landon

See merge request apoulter/mason-today-web!10
parents f6ba3b5d 340a95e7
This diff is collapsed.
#print "and we begin"
from bs4 import BeautifulSoup
from datetime import date, time
import requests
eventDict = {}
......@@ -12,22 +13,34 @@ class Event:
self.__time = "timeplaceholder"
self.__date = "dateplaceholder"
self.__location = "locationplaceholder"
self.__timehour = "00"
self.__timemin = "00"
self.__day = "null day"
def __str__(self):
return self.__name + ": " + self.__description + "\n\n"
def addDescript(description):
def setDescription(description):
self.__description = description
def addTime(time):
def setTime(time):
self.__time = time
def addDate(date):
def setDate(date):
self.__date = date
def addLocation(location):
def setLocation(location):
self.__location = location
def setTimehour(timehour):
self.__timehour = timehour
def setTimeminute(timemin):
self.__timemin = timemin
def setDay(day):
self.__day = day
def cleanup(str):
str = str.replace("&", "&")
str = str.replace(" ", " ")
......@@ -35,6 +48,10 @@ def cleanup(str):
str = str.replace("&lt;", "<")
str = str.replace("&gt;", ">")
str = str.replace("<br/>", "\n")
str = str.replace("Publish event on the Calendar?: TRUE \n" , "")
str = str.replace("Performing any medical procedures?: FALSE \n" , "")
str = str.replace("Parking Needed?: FALSE \n" , "")
str = str[0:len(str) - 1]
return str
......@@ -76,8 +93,7 @@ for entry in entries:
entry_content = entry_content.replace("\n\n" , "\n")
#check clearcontent function
entry_content = cleancontent(entry_content)
entry_content = cleanup(entry_content) #we might just get rid of this one
#each piece of content may is seperated by a newline, entry_detailes creates a list
entry_detailes = entry_content.split("\n")
......@@ -125,7 +141,7 @@ for entry in entries:
entry_detailes[0][0:7] == "Ongoing"):
#See (B)
if len(entry_detailes) == 1:
location = "no location"
entry.location = "no location"
date = entry_detailes[0]
description = "no description"
#see (C)
......@@ -164,7 +180,7 @@ for entry in entries:
description = entry_detailes[2]
#This extra case was made because one entry had the description split into two by a
#newline so it registered as two descriptions making the length = 3
elif len(entry_detailes) == 4:
elif len(entry_detailes) == 4:
location = entry_detailes[0]
date = entry_detailes[1]
description = entry_detailes[2] + " " + entry_detailes[3]
......@@ -175,9 +191,23 @@ for entry in entries:
else:
print "if this prints there is something wrong please don't show up"
date = date.split(",")
day = date[0]
time = date[3][1:]
date = date[1][1:] + "," + date[2]
date = date.split(" ")
month = date[0]
monthday = date[1][:(len(date[1]) - 1)]
year = date[2]
print "-----------------------------------------------------------------------------"
print location
print date
print day
print month
print monthday
print year
print time
print description
print "----------------------------------------------------------------------------"
......@@ -192,5 +222,4 @@ for entry in entries:
#everything in the house is fuzzy
\ No newline at end of file
......@@ -17,5 +17,5 @@ requests
run the following install commands:
$ pip install beautifulsoup4
$ pp install lxml
$ pip install lxml
$ pip install requests
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment