<commit_before>import getpass
import os
import requests
from datetime import datetime
from textwrap import dedent
from pathlib import Path

from pythonanywhere.exceptions import SanityException
from pythonanywhere.snakesay import snakesay


PYTHON_VERSIONS = {
    '2.7': 'python27',
    '3.4': 'python34',
    '3.5': 'python35',
    '3.6': 'python36',
    '3.7': 'python37',
}



class AuthenticationError(Exception):
    pass


def get_api_endpoint():
    domain = os.environ.get('PYTHONANYWHERE_DOMAIN', 'pythonanywhere.com')
    return 'https://www.{domain}/api/v0/user/{{username}}/webapps/'.format(domain=domain)


def call_api(url, method, **kwargs):
    token = os.environ['API_TOKEN']
    insecure = os.environ.get('PYTHONANYWHERE_INSECURE_API') == 'true'
    response = requests.request(
        method=method,
        url=url,
        headers={'Authorization': 'Token {token}'.format(token=token)},<commit_msg>Decouple get_api_endpoints from the webapps flavour<commit_after>import getpass
import os
import requests
from datetime import datetime
from textwrap import dedent
from pathlib import Path

from pythonanywhere.exceptions import SanityException
from pythonanywhere.snakesay import snakesay


PYTHON_VERSIONS = {
    '2.7': 'python27',
    '3.4': 'python34',
    '3.5': 'python35',
    '3.6': 'python36',
    '3.7': 'python37',
}



class AuthenticationError(Exception):
    pass


def get_api_endpoint(flavour="webapps"):
    domain = os.environ.get('PYTHONANYWHERE_DOMAIN', 'pythonanywhere.com')
    return 'https://www.{domain}/api/v0/user/{{username}}/{{flavour}}/'.format(domain=domain, flavour=flavour)


def call_api(url, method, **kwargs):
    token = os.environ['API_TOKEN']
    insecure = os.environ.get('PYTHONANYWHERE_INSECURE_API') == 'true'
    response = requests.request(
        method=method,
        url=url,
        headers={'Authorization': 'Token {token}'.format(token=token)},
{'fraction_non_alphanumeric': 0.13816475495307612, 'fraction_numerical': 0.021897810218978103, 'mean_word_length': 4.436260623229462, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '881359', 'n_tokens_mistral': 652, 'n_tokens_neox': 630, 'n_words': 131}