Use external configuration file

rewrite
Sven Slootweg 12 years ago
parent c274685179
commit e74b025219

2
.gitignore vendored

@ -0,0 +1,2 @@
crawler/calibre.preseed
crawler/config.json

@ -7,6 +7,9 @@ def stringdammit(input_string):
else:
return input_string.encode('utf-8')
config = json.load(open("config.json"))
db = _mysql.connect(config['host'], config['user'], config['password'], config['database'])
pipe_name = 'pipe_books'
if not os.path.exists(pipe_name):
@ -14,7 +17,6 @@ if not os.path.exists(pipe_name):
pipein = open(pipe_name, 'r')
buff = ""
db = _mysql.connect("localhost", "root", "", "ebooks")
while True:
data = pipein.read()

Loading…
Cancel
Save