Skip to content

Data ScrPing error handling using beautifulsoup4. #167

@imsanjoykb

Description

@imsanjoykb
import requests

from urllib.error import HTTPError
 

url = 'https://www.geeksforgeeks.org/implementing-web-scraping-python-beautiful-soup/amp/'
 

try:

    response = requests.get(url)

    response.raise_for_status()

except HTTPError as hp:

    print(hp)

     

else:

print("it's worked")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions