forked from ParthPatel2000/Webscraper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigloader.py
More file actions
30 lines (24 loc) · 816 Bytes
/
configloader.py
File metadata and controls
30 lines (24 loc) · 816 Bytes
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
import yaml
def getlink():
with open('config.yaml') as config:
data = yaml.safe_load(config)
return [data['link']['category'],data['link']['page']]
def getpath():
with open('config.yaml') as config:
data = yaml.safe_load(config)
return data['storagepath']['path']
def update_category(category):
config = open('config.yaml','r')
data = yaml.safe_load(config)
data['link']['category'] = category
with open('config.yaml','w') as config:
yaml.safe_dump(data,config)
def update_pageno(pageno):
config = open('config.yaml', 'r')
data = yaml.safe_load(config)
data['link']['page'] = pageno
with open('config.yaml', 'w') as config:
yaml.safe_dump(data, config)
if __name__ == '__main__':
update_pageno(10)
print(getlink())