import requests
from bs4 import BeautifulSoup


def loadwebsite(url):
    """
        this function loads the website of given url.
        make sure network is connected.

    Parameters
    ----------
    url : str
        website url to be loaded.
        
    Returns
    -------
    webdata : BeautifulSoup Object
        returns the BeautifulSoup object if the website response is 200.
        or else it will return empty string and print the error message when request is made.

    """
    webdata = ""
    response = requests.get(url)
    if response.status_code == 200:
        webdata = BeautifulSoup(response.text, "html.parser")
    else:
        print("[ ! ] failed to request the web : {} reponse code : {}".format(url, response.status_code))
    return webdata