Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:42:54+00:00 2026-06-09T05:42:54+00:00

I am using Beautiful Soup to try and scrape a page. I am trying

  • 0

I am using Beautiful Soup to try and scrape a page.

I am trying to follow this tutorial.

I am trying to get the contents of the following page after submitting a Stock Ticker Symbol:

http://www.cboe.com/delayedquote/quotetable.aspx

The tutorial is for a page with a “GET” method, my page is a “POST”. I wonder if that is part of the problem?

I want use the first text box – under where it says:

“Enter a Stock or Index symbol below for delayed quotes.”

Relevant code:

user_agent = 'Mozilla/5 (Solaris 10) Gecko'
headers = { 'User-Agent' : user_agent }

values = {'ctl00$ctl00$AllContent$ContentMain$ucQuoteTableCtl$txtSymbol' : 'IBM' } 
data = urllib.urlencode(values)
request = urllib2.Request("http://www.cboe.com/delayedquote/quotetable.aspx", data, headers)
response = urllib2.urlopen(request)

The call does not fail, I do not get a set of options and prices returned to me like when I run the page interactively. I a bunch of garbled HTML.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:42:56+00:00Added an answer on June 9, 2026 at 5:42 am

    Ok – I think I figured out the problem (and found another). I decided to switch to ‘mechanize’ from ‘urllib2’. Unfortunately, I kept having problems getting the data. Finally, I realized that there are two ‘submit’ buttons, so I tried passing the name parameter when submitting the form. That did the trick as far as getting the correct response.

    However, the next problem was that I could not get BeautifulSoup to parse the HTML and find the necessary tags. A brief Google search revealed others having similar problems. So, I gave up on BeautifulSoup and just did a basic regex on the HTML. Not as elegant as BeautifulSoup, but effective.

    Ok – enough speechifying. Here’s what I came up with:

    import mechanize
    import re
    
    br = mechanize.Browser()
    url = 'http://www.cboe.com/delayedquote/quotetable.aspx'
    br.open(url)
    br.select_form(name='aspnetForm')
    br['ctl00$ctl00$AllContent$ContentMain$ucQuoteTableCtl$txtSymbol'] = 'IBM'
    # here's the key step that was causing the trouble - pass the name parameter
    # for the button when calling submit
    response = br.submit(name="ctl00$ctl00$AllContent$ContentMain$ucQuoteTableCtl$btnSubmit")
    data = response.read()
    
    match = re.search( r'Bid</font><span>&nbsp;\s*([0-9]{1,4}\.[0-9]{2})', data, re.MULTILINE|re.M|re.I)
    if match:
       print match.group(1)
    else:
       print "There was a problem retrieving the quote"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to scrape form field IDs using Beautiful Soup like this for
I am using python's beautiful stone soup to extract data from this web page
I have this code that fetches some text from a page using BeautifulSoup soup=
I am data mining a website using Beautiful Soup . The first page is
I'm trying to scrape the data off a web page using the python Windmill
I'm writing a page scraper using beautiful soup, and have noticed it will sometimes
I'm using Mechanize and Beautiful soup to scrape some data off Delicious from mechanize
Using Beautiful Soup module, how can I get data of a div tag whose
I am using Beautiful Soup to identify a specific tag and its contents. The
I am trying to parse html using BeautifulSoup to try and extract the webpage

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.