Python Forum
Creating Python dataframes using a County Jail Daily Booking Register (Snohomish, WA)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating Python dataframes using a County Jail Daily Booking Register (Snohomish, WA)
#4
(Mar-24-2020, 02:41 PM)snippsat Wrote: Yes have something to look into and learn,the problem is that you choose not so easy task start with.
Also when struggle with the basic fundamentals of Python,then is not so easy Doh

So to show a demo on how to start,as this site has some challenges.
The description info is generated bye JavaScript,so need to use Selenium.
Need to first click on expand all to activate all data.
Then can parse name and a value as test.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time

#--| Setup
options = Options()
options.add_argument("--headless")
options.add_argument("--window-size=1980,1020")
browser = webdriver.Chrome(executable_path=r'chromedriver.exe', options=options)

#--| Parse or automation
url = 'http://www.snoco.org/app/corrections/jailregister/dailyBookingRegister.aspx'
browser.get(url)
soup = BeautifulSoup(browser.page_source, 'lxml')
expan = browser.find_elements_by_css_selector('#expandAll')
expan[0].click()
name = soup.select_one('#bookingName1') # Use BS
charge_description = browser.find_elements_by_css_selector('#booking1 > p > table > tbody > tr:nth-child(2) > td:nth-child(1)') # Use Sel
print(name.text)
print(charge_description[0].text)
Output:
ALFORD, CALEB AARON PAROLE VIOLATION

snippsat,

Thank you sir for a great starting point with my tasks and challenges set before me with complicated not beginner python projects. You have given me lots of information between this thread and the other which I believe will set me in the right direction.

Upon making progress I will update the threads accordingly!

Best Regards and God Bless,

Brandon Kastning
“And one of the elders saith unto me, Weep not: behold, the Lion of the tribe of Juda, the Root of David, hath prevailed to open the book,...” - Revelation 5:5 (KJV)

“And oppress not the widow, nor the fatherless, the stranger, nor the poor; and ...” - Zechariah 7:10 (KJV)

#LetHISPeopleGo

Reply


Messages In This Thread
RE: Creating Python dataframes using a County Jail Daily Booking Register (Snohomish, WA) - by BrandonKastning - Mar-25-2020, 08:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Online calendar for booking. SpongeB0B 6 3,596 Nov-15-2023, 11:27 AM
Last Post: Woki
  register the user as staff member - django rwahdan 0 1,505 Dec-24-2021, 03:08 PM
Last Post: rwahdan
  Scraping daily football score shamil1999 2 2,778 Sep-18-2019, 09:55 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020