Делов-то, за утренним кофе, остальное причешите сами:
import requests
from bs4 import BeautifulSoup as BS
zodiacs = {
"Овен": {"unicode": 9800, "latin": "Aries"},
"Телец": {"unicode": 9801, "latin": "Taurus"},
"Близнецы": {"unicode": 9802, "latin": "Gemini"},
"Рак": {"unicode": 9803, "latin": "Cancer"},
"Лев": {"unicode": 9804, "latin": "Leo"},
"Дева": {"unicode": 9805, "latin": "Virgo"},
"Весы": {"unicode": 9806, "latin": "Libra"},
"Скорпион": {"unicode": 9807, "latin": "Scorpio"},
"Змееносец": {"unicode": 9934, "latin": "Ophiuchus"},
"Стрелец": {"unicode": 9808, "latin": "Sagittarius"},
"Козерог": {"unicode": 9809, "latin": "Capricon"},
"Водолей": {"unicode": 9810, "latin": "Aquarius"},
"Рыбы": {"unicode": 9811, "latin": "Pisces"}
}
def get_horoscope(zodiac, URL='https://horoscopes.rambler.ru'):
ASKURL = f'{URL}/{zodiac.lower()}/'
HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0'}
response = requests.get(ASKURL, headers=HEADERS)
soup = BS(response.content, 'html.parser')
item = soup.findAll('div', class_='_1E4Zo _3BLIa')[0]
parse_result = item.find('p', class_='mtZOt').get_text(strip=True)
return parse_result
def get_info(zodiac):
ask_horo = zodiacs[zodiac].get('latin')
uni_horo = chr(zodiacs[zodiac].get('unicode'))
result_horo = get_horoscope(ask_horo)
return f'Результаты для знака зодиака {zodiac}- {ask_horo} - {uni_horo}\n{result_horo}'
my_horo = get_info('Дева')
print(my_horo)