Не могу получить ссылку в теге парсером

import requests
from bs4 import BeautifulSoup

URL = 'https://auto.ria.com/newauto/marka-jeep/'
HEADERS = {
    'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36',
    'accept': '*/*'
}
HOST = 'https://auto.ria.com'

def get_html(url, params=None):  # Передаем в функцию ссылку и номер страницы
    r = requests.get(url, headers=HEADERS, params=params)
    return r


def get_content(html,):  # Передаем html конструктору
    soup = BeautifulSoup(html, 'html.parser')
    items = soup.find_all('section', class_='proposition')  # Указываем в каких тэгах нужная информация

    cars = []   
    for item in items:
        cars.append({
            'title': item.find('div', class_="proposition_title").get_text(strip=True),
            'link': HOST + item.find('a', class_="proposition_link").get_text('href'),
        })

    print(cars)
    print(len(cars))

def parse():
    html = get_html(URL)
    if html.status_code == 200:
        get_content(html.text)
    else:
        print('Error')


parse()

Ошибка:

Traceback (most recent call last): File "/home/ezv/parser/parser.py", line 39, in parse() File "/home/ezv/parser/parser.py", line 34, in parse get_content(html.text) File "/home/ezv/parser/parser.py", line 25, in get_content 'link': HOST + item.find('a', class_="proposition_link").get_text('href'), AttributeError: 'NoneType' object has no attribute 'get_text'


Ответы (1 шт):

Автор решения: Захар Елисеев
for item in items: 
    a_tag = item.find('a', class_="proposition_link") 
        if a_tag: 
            cars.append({ 
                          'title': item.find('div', 
                           class_="proposition_title").get_text(strip=True), 
                          'link': HOST + a_tag['href'], })
→ Ссылка