import requests
from bs4 import BeautifulSoup


def get_html_from(page):
    """ Returns the HTML code from the website. """

    print('Scraping data from page:', page)
    url = f'https://app-post.net/index.php/page/{page}/'
    headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15'}
    response = requests.get(url, headers=headers)
    if response.status_code != 200:
        print(f'The returned status code is: {response.status_code}')
    print('Status code:', response.status_code)

    soup = BeautifulSoup(response.text, 'lxml')
    print('Returned soup.\n')

    return soup