Browse Source

Use external configuration file

rewrite
Sven Slootweg 9 years ago
parent
commit
e74b025219
  1. 2
      .gitignore
  2. 4
      crawler/daemon.py

2
.gitignore

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

4
crawler/daemon.py

@ -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