"metadata": {
"collapsed": false
},
+ "outputs": [],
+ "source": [
+ "conn = psycopg2.connect(host=config['database']['server'],\n",
+ " database=config['database']['database'], \n",
+ " user=config['database']['username'], \n",
+ " password=config['database']['password'])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
"outputs": [
{
"data": {
"text/plain": [
- "datetime.datetime(2016, 3, 29, 23, 59, 59)"
+ "datetime.datetime(2016, 3, 30, 23, 59, 59)"
]
},
- "execution_count": 12,
+ "execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "with psycopg2.connect(host=config['database']['server'],\n",
- " database=config['database']['database'], \n",
- " user=config['database']['username'], \n",
- " password=config['database']['password']) as conn:\n",
+ "with conn:\n",
" with conn.cursor() as cur:\n",
" cur.execute('select max(report_metadata_date_range_end) from reports')\n",
" results = cur.fetchall()\n",
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 14,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "('OK', [b'178'])"
+ "('OK', [b'179'])"
]
},
- "execution_count": 13,
+ "execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 15,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "('SINCE 27-Mar-2016', 'OK', [b'169 170 171 172 173 174 175 176 177 178 179'])"
+ "('SINCE 28-Mar-2016', 'OK', [b'172 173 174 175 176 177 178 179 180'])"
]
},
- "execution_count": 14,
+ "execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": 16,
"metadata": {
"collapsed": false
},
{
"data": {
"text/plain": [
- "['1458957186.548175',\n",
- " '2150510829392606201',\n",
- " '68aad5080a774e2c997d159b546569b9@hotmail.com',\n",
- " '1459129809.695034',\n",
+ "['1459129809.695034',\n",
" '16143280651570354241',\n",
" '8c177254c3cb41869dc3afab59f74c76@hotmail.com',\n",
" '15410706527896810898',\n",
" '1459216304.582931',\n",
" '15497495941279624940',\n",
" '1459302353.261157',\n",
- " '7773a696f4a54f1e8c01f4644fbb94ee@hotmail.com']"
+ " '7773a696f4a54f1e8c01f4644fbb94ee@hotmail.com',\n",
+ " '15185964531645951164']"
]
},
- "execution_count": 15,
+ "execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": 17,
"metadata": {
"collapsed": false
},
"('BYE', [b'Logging out'])"
]
},
- "execution_count": 16,
+ "execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
"metadata": {
"collapsed": false
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "write 1459302353.261157\n",
- "write 7773a696f4a54f1e8c01f4644fbb94ee@hotmail.com\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
- "with psycopg2.connect(host=config['database']['server'],\n",
- " database=config['database']['database'], \n",
- " user=config['database']['username'], \n",
- " password=config['database']['password']) as conn:\n",
+ "with conn:\n",
" with conn.cursor() as cur:\n",
" for report in dmarc_reports:\n",
" cur.execute('select id, report_metadata_report_id from reports where report_metadata_report_id = %s;', \n",
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 19,
"metadata": {
"collapsed": true
},
"outputs": [],
- "source": []
+ "source": [
+ "conn.close()"
+ ]
}
],
"metadata": {