C
Cy Gar
after reading about hpricot, mechanize and htree gems, I made an attempt
to write a simple code to grab property tax info for homes in Los
Angeles. i wrote this fragment which goes to the assessor's website,
finds the form entries and correctly puts in an apn number (property
parcel number) but fails at the submit line. I tried page =
agent.submit(form) also to no avail. What am I doing wrong?
Two side questions: How do you auto-indent ruby code? I am using SciTe
editor and i find myself using my old matlab editor every once in a
while to beautify the codes. Hw could ruby not have auto-indentor?
Also quick way of turning an html table into a matrix, array of arrays?
thanks in advance.
require 'rubygems'
require 'hpricot'
require 'mechanize'
agent = WWW::Mechanize.new
apn='2264-011-027'
page =
agent.get('https://ttc.lacounty.gov/secured_asp/vcheck_new/index.php')
form=page.forms.with.name("pageform").first
form['mapbook']=apn[0,4]
form.page=apn[5,3]
form.parcel=apn[9,3]
page = agent.submit(form,form.buttons.first) #gives error
error:
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize/page.rb:104:in
`bases': undefined method `search' for nil:NilClass (NoMethodError)
from
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize.rb:440:in
`to_absolute_uri'
from
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize.rb:659:in
`fetch_page'
from
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize.rb:466:in
`post_form'
from
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize.rb:269:in
`submit'
to write a simple code to grab property tax info for homes in Los
Angeles. i wrote this fragment which goes to the assessor's website,
finds the form entries and correctly puts in an apn number (property
parcel number) but fails at the submit line. I tried page =
agent.submit(form) also to no avail. What am I doing wrong?
Two side questions: How do you auto-indent ruby code? I am using SciTe
editor and i find myself using my old matlab editor every once in a
while to beautify the codes. Hw could ruby not have auto-indentor?
Also quick way of turning an html table into a matrix, array of arrays?
thanks in advance.
require 'rubygems'
require 'hpricot'
require 'mechanize'
agent = WWW::Mechanize.new
apn='2264-011-027'
page =
agent.get('https://ttc.lacounty.gov/secured_asp/vcheck_new/index.php')
form=page.forms.with.name("pageform").first
form['mapbook']=apn[0,4]
form.page=apn[5,3]
form.parcel=apn[9,3]
page = agent.submit(form,form.buttons.first) #gives error
error:
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize/page.rb:104:in
`bases': undefined method `search' for nil:NilClass (NoMethodError)
from
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize.rb:440:in
`to_absolute_uri'
from
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize.rb:659:in
`fetch_page'
from
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize.rb:466:in
`post_form'
from
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.7.6/lib/www/mechanize.rb:269:in
`submit'