from django.contrib.auth.models import User
from django.contrib.auth.backends import ModelBackend
import requests
+from django.conf import settings
class EmailBackend(ModelBackend):
def fetch_fortnox(self):
""" Fetch all active customers from Fortnox API. Return as dict keyed on email."""
res = None
customers = {}
- headers = {"Access-Token":FORTNOX_Access_Token,
- "Client-Secret":FORTNOX_Client_Secret,
+ headers = {"Access-Token":settings.FORTNOX_ACCESS_TOKEN,
+ "Client-Secret":settings.FORTNOX_CLIENT_SECRET,
"Content-Type":"application/json",
"Accept":"application/json" }
"""
import os
-from settings_secret import *
+try:
+ from .settings_secret import *
+except ImportError:
+ pass
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))