from requests.connection import get_cursor def get_sections(): cursor = get_cursor() cursor.execute("select name from sections") return [elem[0] for elem in cursor.fetchall()]