Status

Location
London, England
Subscribe to GeoRSS Subscribe to KML


open-uri and can’t convert Hash into String

Published in Programming, Ruby  |  1 Comment


I’m posting this in hopes that search engines grab it and put it at the top of their list when other poor soul’s run into this problem.

If you’re trying to grab a web resource using Open-URI, and you are using basic authentication (username/password) then you’ll need to make sure to require 'open-uri' or you’ll get:

open("http://example.com/site", :http_basic_authentication => ["username", "password"])
TypeError: can't convert Hash into String

Of course, then you toss some yummy Hpricot into the mix for parsing/scraping the good bits of the HTML.

Similar Posts


Responses

  1. Peter says:

    March 20th, 2007 at 9:36 am (#)

    Or you can use something like scRUBYt! - basic authentication is not yet supported in the present version, but will be added with the next release.

Leave a Response