-
Notifications
You must be signed in to change notification settings - Fork 0
/
Book.py
49 lines (35 loc) · 1.01 KB
/
Book.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class bookScraping:
def __inti__(self,baseUrl,uri,nbPage):
self.setBaseUrl(baseUrl)
self.setUri(uri)
self.setNbPage = nbPage
self.urls = []
def setBaseUrl(self,url):
response = requests.get(url)
if response.ok:
self.baseUrl = url
else:
print("Your Url is not OK")
exit()
def setUri(self,uri):
self.uri = uri
def getLinks(self):
for i in range(self.nbPage):
self.urls.append(self.baseUrl + self.uri + str(i))
class Book:
def __init__(self, name, author, price):
self.set_name(name)
self.set_author(author)
self.set_price(price)
def set_name(self, name):
self.name = name
def set_author(self, author):
self.author = author
def set_price(self, price):
self.price = price
def get_name(self):
return self.name
def get_author(self):
return self.author
def get_price(self):
return self.price