Ask coding questions

← Back to all posts
Python web scraping and importing modules
Deacon_Cronin (66)

Hi, I have been wanting to try web scraping with Python and most of the guides I find require two modules called "beautiful soup" and "requests" and I am not sure how to import these modules. Simply using the import command does not work. I can find requests on the import browser (on this website, not sure if it's the right one: but I cannot find beautiful soup on the browser or using the import command. Any help is appreciated!

Answered by heyitsmarcus (347) [earned 5 cycles]
View Answer
heyitsmarcus (347)

Hey @Deacon_Cronin,

I found beautiful soup in the Package manager in Python repls. Search for beautifulsoup4 which is the official package name. And requests is also in there under just "requests".

The description for beautifulsoup4 is "Screen-scraping library" and has a package homepage which is

The description for requests is "Python HTTP for Humans." and has a package homepage which is

Deacon_Cronin (66)

@heyitsmarcus Thank you very much for the response! I suppose I'm just blind and unable to find things. Thank you! Edit: Actually I'm still having some problems. Importing requests is fine, but I can't find the actual name to import for beautifulsoup. I tried beautifulsoup4 but it doesn't work.

heyitsmarcus (347)

@Deacon_Cronin No worries at all! If I helped you find your answer, please consider upvoting my answer and choosing it as the accepted answer to close this question. Cheers!

Deacon_Cronin (66)

@heyitsmarcus I will, but I'm actually still having some problems with actually importing the module. See the edit I made.

heyitsmarcus (347)

@Deacon_Cronin No problem, Deacon. I made a little repl for you with some simple BeautifulSoup code.

I hope that helps some!

heyitsmarcus (347)

@heyitsmarcus That package homepage that I referenced in my original comment has documentation for BeautifulSoup that will really help! Here is a link directly to it for convenience:

Deacon_Cronin (66)

@heyitsmarcus My mistake! I missed the 'from bs4' Thank you for your help!