21 lines
		
	
	
		
			471 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			471 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| # -*- coding: utf-8 -*-
 | |
| import sys
 | |
| import os
 | |
| import re
 | |
| from pprint import pprint
 | |
| 
 | |
| import requests
 | |
| import psycopg2
 | |
| from dotenv import load_dotenv
 | |
| from psycopg2.extras import DictCursor
 | |
| 
 | |
| # Handy alias for pprint
 | |
| pp = pprint
 | |
| 
 | |
| # Load dotenv from DOTENV_FILE variable (or the default one)
 | |
| load_dotenv(os.environ.get('DOTENV_FILE', '.env'))
 | |
| 
 | |
| # Create database connection and cursor
 | |
| con = psycopg2.connect(os.environ['DATABASE_URI'])
 | |
| cur = con.cursor(cursor_factory=DictCursor)
 |