summaryrefslogtreecommitdiff
path: root/scripts/pyranking/db.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-09-07 02:10:36 +0200
committeremkael <emkael@tlen.pl>2017-09-07 02:10:36 +0200
commit4060fa99c23bca17895029ae1ffad24d0d024269 (patch)
treecf4f322e236d913e238366a2de30727d0d2561cb /scripts/pyranking/db.py
parent26f2934bcdfec9b32131ec01bbdd493146b3ad57 (diff)
Moving *.py scripts to separate directory, cleaning things up
Diffstat (limited to 'scripts/pyranking/db.py')
-rw-r--r--scripts/pyranking/db.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/pyranking/db.py b/scripts/pyranking/db.py
new file mode 100644
index 0000000..16595d3
--- /dev/null
+++ b/scripts/pyranking/db.py
@@ -0,0 +1,13 @@
+import json
+import mysql.connector
+
+settings = json.load(file('config/db.json'))
+
+connection = mysql.connector.connect(
+ user=settings['user'],
+ password=settings['pass'],
+ host=settings['host'],
+ port=settings['port'],
+ database=settings['db']
+)
+cursor = connection.cursor(dictionary=True, buffered=True)