<commit_before>"""Implements known blink API calls."""

import logging
from json import dumps
import blinkpy.helpers.errors as ERROR
from blinkpy.helpers.util import http_req, BlinkException
from blinkpy.helpers.constants import DEFAULT_URL

_LOGGER = logging.getLogger(__name__)


def request_login(blink, url, username, password):
    """Login request."""
    headers = {
        'Host': DEFAULT_URL,
        'Content-Type': 'application/json'
    }
    data = dumps({
        'email': username,
        'password': password,
        'client_specifier': 'iPhone 9.2 | 2.2 | 222'
    })
    return http_req(blink, url=url, headers=headers, data=data,
                    json_resp=False, reqtype='post')


def request_networks(blink):
    """Request network information."""
    url = "{}/networks".format(blink.urls.base_url)
    return http_get(blink, url)


def request_syncmodule(blink, network):
    """Request sync module info."""
    url = "{}/network/{}/syncmodules".format(blink.urls.base_url, network)
    return http_get(blink, url)


def request_system_arm(blink, network):
    """Arm system."""
    url = "{}/network/{}/arm".format(blink.urls.base_url, network)
    return http_post(blink, url)


def request_system_disarm(blink, network):
    """Disarm system."""
    url = "{}/network/{}/disarm".format(blink.urls.base_url, network)
    return http_post(blink, url)


def request_command_status(blink, network, command_id):
    """Request command status."""
    url = "{}/network/{}/command/{}".format(blink.urls.base_url,
                                               network,
                                               command_id)
    return http_get(blink, url)


def request_homescreen(blink):
    """Request homescreen info."""<commit_msg>Add method to request the Network/System status<commit_after>"""Implements known blink API calls."""

import logging
from json import dumps
import blinkpy.helpers.errors as ERROR
from blinkpy.helpers.util import http_req, BlinkException
from blinkpy.helpers.constants import DEFAULT_URL

_LOGGER = logging.getLogger(__name__)


def request_login(blink, url, username, password):
    """Login request."""
    headers = {
        'Host': DEFAULT_URL,
        'Content-Type': 'application/json'
    }
    data = dumps({
        'email': username,
        'password': password,
        'client_specifier': 'iPhone 9.2 | 2.2 | 222'
    })
    return http_req(blink, url=url, headers=headers, data=data,
                    json_resp=False, reqtype='post')


def request_networks(blink):
    """Request network information."""
    url = "{}/networks".format(blink.urls.base_url)
    return http_get(blink, url)

def request_network_status(blink, network):
    """Request network information."""
    url = "{}/network/{}".format(blink.urls.base_url, network)
    return http_get(blink, url)


def request_syncmodule(blink, network):
    """Request sync module info."""
    url = "{}/network/{}/syncmodules".format(blink.urls.base_url, network)
    return http_get(blink, url)


def request_system_arm(blink, network):
    """Arm system."""
    url = "{}/network/{}/arm".format(blink.urls.base_url, network)
    return http_post(blink, url)


def request_system_disarm(blink, network):
    """Disarm system."""
    url = "{}/network/{}/disarm".format(blink.urls.base_url, network)
    return http_post(blink, url)


def request_command_status(blink, network, command_id):
    """Request command status."""
    url = "{}/network/{}/command/{}".format(blink.urls.base_url,
                                               network,
                                               command_id)
    return http_get(blink, url)


def request_homescreen(blink):
    """Request homescreen info."""
{'fraction_non_alphanumeric': 0.13793103448275862, 'fraction_numerical': 0.0037423148890670943, 'mean_word_length': 3.0851528384279474, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4959733', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1123, 'n_words': 257}