-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
73 lines (58 loc) · 2.09 KB
/
main.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from billboard_app import Billboard
from genius_app import Genius
import datetime
class Data_miner:
current_year = datetime.datetime.now().year
def find_all(self):
pass
def find_by_date(self):
input_date = {
'year': self.get_year(),
'mounth': self.get_mounth(),
'day': self.get_day()
}
Billboard().req_to_billboard(input_date)
def get_year(self):
year = input(f'Enter year from 1958 to {self.current_year}: ')
return self.check_year(year)
def get_mounth(self):
mounth = input('Enter mounth: from 01 to 12: ')
return self.check_mounth(mounth)
def get_day(self):
day = input('Enter day: from 01 to 31: ')
return self.check_day(day)
def check_year(self,year):
if year.isnumeric():
if int(year) <= self.current_year and int(year) >= 1958:
return year
else:
print(f'Year must be a number from 1958 to {self.current_year}')
self.get_year()
else:
print('Year must be a number')
self.get_year()
def check_mounth(self,mounth):
if mounth.isnumeric():
if int(mounth) <= 12 and int(mounth) >= 1:
if len(mounth) != 2:
mounth = '0' + mounth
return mounth
else:
print(f'Mounth must be a number from 1 to 12')
self.get_mounth()
else:
print('Mounth must be a number')
self.get_mounth()
def check_day(self,day):
if day.isnumeric():
if int(day) <= 31 and int(day) >= 1:
if len(day) != 2:
day = '0' + day
return day
else:
print(f'Day must be a number from 1 to 31')
self.get_day()
else:
print('Day must be a number')
self.get_day()
instance = Data_miner().find_by_date()