<commit_before>from django.conf import settings as django_settings
from django.core.urlresolvers import reverse

from oidc_provider import settings


def get_issuer():
    """
    Construct the issuer full url. Basically is the site url with some path
    appended.
    """
    site_url = settings.get('SITE_URL')
    path = reverse('oidc_provider:provider_info') \
        .split('/.well-known/openid-configuration/')[0]
    issuer = site_url + path

    return issuer


def get_rsa_key():
    """
    Load the rsa key previously created with `creatersakey` command.
    """
    file_path = settings.get('OIDC_RSA_KEY_FOLDER') + '/OIDC_RSA_KEY.pem'
    with open(file_path, 'r') as f:
        key = f.read()

    return key
<commit_msg>Add IOError custom message when rsa key file is missing.<commit_after>from django.conf import settings as django_settings
from django.core.urlresolvers import reverse

from oidc_provider import settings


def get_issuer():
    """
    Construct the issuer full url. Basically is the site url with some path
    appended.
    """
    site_url = settings.get('SITE_URL')
    path = reverse('oidc_provider:provider_info') \
        .split('/.well-known/openid-configuration/')[0]
    issuer = site_url + path

    return issuer


def get_rsa_key():
    """
    Load the rsa key previously created with `creatersakey` command.
    """
    file_path = settings.get('OIDC_RSA_KEY_FOLDER') + '/OIDC_RSA_KEY.pem'
    try:
        with open(file_path, 'r') as f:
            key = f.read()
    except IOError:
        raise IOError('We could not find your key file on: ' + file_path)

    return key

{'fraction_non_alphanumeric': 0.10135135135135136, 'fraction_numerical': 0.0012285012285012285, 'mean_word_length': 3.1136363636363638, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1190730', 'n_tokens_mistral': 533, 'n_tokens_neox': 514, 'n_words': 148}