[Python] Why do i get a TypeError on this?

Discussão em 'Python' iniciado por Stack, Maio 24, 2025.

  1. Stack

    Stack Membro Participativo

    I am having this error when i am trying to create soup. This here is my code.

    import requests
    from bs4 import BeautifulSoup


    response = requests.get('https://appbrewery.github.io/instant_pot/')

    soup = BeautifulSoup(response, 'html.parser')
    print(soup.prettify())


    and the error i am getting....

    Traceback (most recent call last):
    File "/home/yunus/Desktop/Amazon price tracke/main.py", line 7, in <module>
    soup = BeautifulSoup(response, 'html.parser')
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/yunus/Desktop/Amazon price tracke/venv/lib/python3.12/site-packages/bs4/__init__.py", line 442, in __init__
    raise TypeError(
    TypeError: Incoming markup is of an invalid type: <Response [200]>. Markup must be a string, a bytestring, or an open filehandle.


    clearly there is nothing wrong with the response am getting but when i am trying to create soup.

    Continue reading...

Compartilhe esta Página