Here are the examples of the python api django.conf.settings.KEL taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
3
View Complete Implementation : authentication.py
Copyright Apache License 2.0
Author : kelproject
Copyright Apache License 2.0
Author : kelproject
def check_idensaty(self, token):
"""
Lookup token on idensaty service and create/update local user.
"""
logger.info("checking idensaty server {}".format(settings.KEL["IDENsatY_URL"]))
params = {"access_token": token}
resp = requests.get("{}/tokeninfo/".format(settings.KEL["IDENsatY_URL"]), params=params)
if not resp.ok:
return None
payload = resp.json()
with transaction.atomic():
user = next(iter(User.objects.filter(username=payload["user"]["username"])), None)
if user is None:
user = User.objects.create(username=payload["user"]["username"])
else:
user.last_login = timezone.now()
user.save()
return user
3
View Complete Implementation : models.py
Copyright Apache License 2.0
Author : kelproject
Copyright Apache License 2.0
Author : kelproject
@property
def path(self):
return "/{}/{}{}".format(
settings.KEL["BLOBSTORE"]["BUCKET"],
settings.KEL["BLOBSTORE"].get("PATH_PREFIX", ""),
self.name
)
3
View Complete Implementation : models.py
Copyright Apache License 2.0
Author : kelproject
Copyright Apache License 2.0
Author : kelproject
def generate_signed_url(self):
if settings.KEL["BLOBSTORE"]["BACKEND"] == "gcp":
from .backends import gcp
return gcp.make_storage_signed_url(
"PUT",
self.path,
datetime.timedelta(minutes=5),
content_type=self.content_type,
service_account=gcp.GoogleServiceAccount.from_data(
settings.KEL["BLOBSTORE"]["SERVICE_ACCOUNT"]
),
)
0
View Complete Implementation : models.py
Copyright Apache License 2.0
Author : kelproject
Copyright Apache License 2.0
Author : kelproject
@property
def url(self):
if settings.KEL["BLOBSTORE"]["BACKEND"] == "gcp":
from .backends import gcp
return "{}{}".format(gcp.GCS_API_URL, self.path)