Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from urllib import request
- from bs4 import BeautifulSoup
- class getUrl(object):
- def __init__(self):
- self.appList = []
- self.page = None
- def getPage(self, url):
- url = request.urlopen(url)
- self.page = url.read()
- url.close()
- def parsePage(self):
- soup = BeautifulSoup(self.page)
- for link in soup.find_all("a"):
- self.appList.append(link.get('href'))
- return (self.appList)
- class getApp(object):
- def __init__(self):
- pass
- def selectApp(self):
- for i in getUrl.appList():
- return print(i)
- a = getUrl()
- a.getPage("http://somepage/page")
- a.parsePage()
- b = getApp()
- b.selectApp()
- AttributeError: type object 'getUrl' has no attribute 'appList'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement