Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getData(self):
- """ Get pending calendar events """
- def pendingPageLoaded(self, result):
- # Time to break out the HTML parser
- soup = BeautifulSoup(result)
- soupupcoming = soup.findAll('li', 'event-category')
- soupevents = soupupcoming[0].findAll('li', "event-summary")
- events = []
- for soupevent in soupevents:
- event = {}
- # Get the event id
- event["event-id"] = soupevent['data-id']
- # Get the event title
- event["title"] = BeautifulStoneSoup(soupevent.findAll('h4', 'subheader name')[0].text, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
- # Get the event description
- event["description"] = BeautifulStoneSoup(soupevent.findAll('p', 'description')[0].text, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
- # Get the date of the event
- event["date"] = soupevent.findAll('span', 'datetime')[0].text
- # Are we invited?
- if soupevent.findAll('span', 'status invited'):
- event["invited"] = True
- else:
- event["invited"] = False
- events.append(event)
- return events # This needs to make it's way back to whatever called getData somehow
- # Grab the calendar page
- d = client.getPage("https://eu.battle.net/wow/en/vault/character/event", cookies=self.cookies)
- d.addCallback(self.pendingPageLoaded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement