Web scraper BeautifulSoup

Hello, I'm wanting to add beautifulsoup 3.2.2 on ignition 7.9 but ignition wont add it when i do file>import any help would be great, thanks
BeautifulSoup3.2.2.zip (22.0 KB)

https://docs.inductiveautomation.com/display/DOC79/Libraries#Libraries-Importing3rdPartyLibraries

If it's the one from this post (and looking at the file, I believe it is), then this was put together for 8.x

You can try unzipping it, then copying the contents of code.py into a blank script.

Open it in notepad and copy everything into a script? And where would I do the parsing, in the same script?

Yes to both. :slight_smile:

i did then i opened script console and put this in
from BeautifulSoup import BeautifulSoup

url = "http://192.168.140.31/15"
soup = BeautifulSoup(system.net.httpGet(url))

t = soup.find('table')
tr = t.findAll('tr')

headers = ['meter', 'value']
data =
for row in tr:
td = row.findAll('td')
if len(td) > 0:
data.append([col.text for col in td])

dataOut = system.dataset.toDataSet(headers, data)

but got the following error

"eback (most recent call last):
File "", line 1, in
ImportError: No module named BeautifulSoup"

Please edit your post, select the code block, and press the </> button to format it as code. This will preserve indentation and apply syntax highlighting.

  • Show us where you put it. This will affect where your import happens.
  • You're not going to get anything from my power meter. It doesn't go to the internet. :wink:

oh sorry, here's where i put the code.py in

my goal is to parse out information from a river weather station online.

im also assuming i need to put this in gateway startup scripts

from NewScript import BeautifulSoup

Or, rename NewScript...

Also I see an error marker at the bottom. There might be something in the copy/paste that didn't come through.
image

I renamed and published but i still get and also went back to the original name

Traceback (most recent call last):
File "", line 1, in
ImportError: No module named NewScript

Edit: also got rid of the red error line.

Ok, had to spin up a 7.9 VM...

Here's one that will import into 7.9
BeautifulSoup_3.3.2.proj (29.8 KB)

Be sure to save after importing.

from project.BeautifulSoup import BeautifulSoup

or, if you import it into the global scripts:

from shared.BeautifulSoup import BeautifulSoup

apologies but im getting this error. im running 7.9.4
Screenshot 2023-05-03 073523

actually i just changed the rev in the notepad and it imported hopefully it will work i appreciate all the help

1 Like

We always recommend upgrading to the latest version. (7.9.21) :wink:

i dont think i can do this ive tried for the past 16 hours and i cant parse a single html text but beautiful soup works :slight_smile: at least i think it does.

What's the issue ?

im trying to scrap the cfs data on this website MERCED R NR BRICEBURG #2 (MBG)

but i just dont know how to write it. i can get the html but idk how to parse it. all the examples online don't really help bc the commands dont work. i was also assuming i need to download pip.

I can't even open that page ;D

edit: I have some free time (but not a lot), so if you want help parsing html, I'll be there for a little while.