import requests
from .track import getGroupData

def isCheckURLValid(url):
    if not url.startswith("http"):
        raise MissingPrefixError(url)

    #may raise other errors eg. ConnectionError / Timeout
    if getGroupData(url) == None:
        raise InvalidURLError(url)
    else:
        return True

def isSendURLValid(url):
    if not url.startswith("http"):
        raise MissingPrefixError(url)

    TITLE = "Temperature Recording"
    HEADER = "RECORD YOUR TEMPERATURE"
    INVALID = "Invalid code"

    request = requests.get(url=url)
    response = request.text

    if INVALID in response:
        raise InvalidCodeError(url)
    elif TITLE not in response or HEADER not in response:
        raise InvalidURLError(url)
    else:
        return True

class MissingPrefixError(Exception):
    def __init__(self, url):
        super().__init__("URL missing http prefix. Do you mean https://" + url)

class InvalidCodeError(Exception):
    def __init__(self, url):
        super().__init__("Invalid groupcode.")

class InvalidURLError(Exception):
    def __init__(self, url):
        super().__init__("Invalid URL. Is it even temptaking.ado.sg?")
255b2a4c2713b248689db8d101b3c0ca1c3f4848
<mask token>


class MissingPrefixError(Exception):
    <mask token>


class InvalidCodeError(Exception):

    def __init__(self, url):
        super().__init__('Invalid groupcode.')


class InvalidURLError(Exception):

    def __init__(self, url):
        super().__init__('Invalid URL. Is it even temptaking.ado.sg?')

<mask token>


class MissingPrefixError(Exception):

    def __init__(self, url):
        super().__init__('URL missing http prefix. Do you mean https://' + url)


class InvalidCodeError(Exception):

    def __init__(self, url):
        super().__init__('Invalid groupcode.')


class InvalidURLError(Exception):

    def __init__(self, url):
        super().__init__('Invalid URL. Is it even temptaking.ado.sg?')

<mask token>


def isCheckURLValid(url):
    if not url.startswith('http'):
        raise MissingPrefixError(url)
    if getGroupData(url) == None:
        raise InvalidURLError(url)
    else:
        return True


def isSendURLValid(url):
    if not url.startswith('http'):
        raise MissingPrefixError(url)
    TITLE = 'Temperature Recording'
    HEADER = 'RECORD YOUR TEMPERATURE'
    INVALID = 'Invalid code'
    request = requests.get(url=url)
    response = request.text
    if INVALID in response:
        raise InvalidCodeError(url)
    elif TITLE not in response or HEADER not in response:
        raise InvalidURLError(url)
    else:
        return True


class MissingPrefixError(Exception):

    def __init__(self, url):
        super().__init__('URL missing http prefix. Do you mean https://' + url)


class InvalidCodeError(Exception):

    def __init__(self, url):
        super().__init__('Invalid groupcode.')


class InvalidURLError(Exception):

    def __init__(self, url):
        super().__init__('Invalid URL. Is it even temptaking.ado.sg?')

import requests
from .track import getGroupData


def isCheckURLValid(url):
    if not url.startswith('http'):
        raise MissingPrefixError(url)
    if getGroupData(url) == None:
        raise InvalidURLError(url)
    else:
        return True


def isSendURLValid(url):
    if not url.startswith('http'):
        raise MissingPrefixError(url)
    TITLE = 'Temperature Recording'
    HEADER = 'RECORD YOUR TEMPERATURE'
    INVALID = 'Invalid code'
    request = requests.get(url=url)
    response = request.text
    if INVALID in response:
        raise InvalidCodeError(url)
    elif TITLE not in response or HEADER not in response:
        raise InvalidURLError(url)
    else:
        return True


class MissingPrefixError(Exception):

    def __init__(self, url):
        super().__init__('URL missing http prefix. Do you mean https://' + url)


class InvalidCodeError(Exception):

    def __init__(self, url):
        super().__init__('Invalid groupcode.')


class InvalidURLError(Exception):

    def __init__(self, url):
        super().__init__('Invalid URL. Is it even temptaking.ado.sg?')

import requests
from .track import getGroupData

def isCheckURLValid(url):
    if not url.startswith("http"):
        raise MissingPrefixError(url)

    #may raise other errors eg. ConnectionError / Timeout
    if getGroupData(url) == None:
        raise InvalidURLError(url)
    else:
        return True

def isSendURLValid(url):
    if not url.startswith("http"):
        raise MissingPrefixError(url)

    TITLE = "Temperature Recording"
    HEADER = "RECORD YOUR TEMPERATURE"
    INVALID = "Invalid code"

    request = requests.get(url=url)
    response = request.text

    if INVALID in response:
        raise InvalidCodeError(url)
    elif TITLE not in response or HEADER not in response:
        raise InvalidURLError(url)
    else:
        return True

class MissingPrefixError(Exception):
    def __init__(self, url):
        super().__init__("URL missing http prefix. Do you mean https://" + url)

class InvalidCodeError(Exception):
    def __init__(self, url):
        super().__init__("Invalid groupcode.")

class InvalidURLError(Exception):
    def __init__(self, url):
        super().__init__("Invalid URL. Is it even temptaking.ado.sg?")