William Flanagan
2007-Mar-18 20:39 UTC
[Mechanize-users] Submitting a form sends a file. How do I save it?
I''ve been using Mechanize for a project that i''ve been working on, but this is the first time i''m having to use forms (scraping previously). So, after i fill out the form, when I hit submit, it sends me information in the form of a text file to download. For the life of me, I can''t see how to get access to it. When clicking on a link, you can put a save_as on it and save the data as a file. How do I save off data that''s sent to me via the submit of a form? Thanks for any advice, Will
Aaron Patterson
2007-Mar-18 23:03 UTC
[Mechanize-users] Submitting a form sends a file. How do I save it?
On Sun, Mar 18, 2007 at 04:39:21PM -0400, William Flanagan wrote:> I''ve been using Mechanize for a project that i''ve been working on, > but this is the first time i''m having to use forms (scraping > previously). So, after i fill out the form, when I hit submit, it > sends me information in the form of a text file to download. For the > life of me, I can''t see how to get access to it. When clicking on a > link, you can put a save_as on it and save the data as a file. > > How do I save off data that''s sent to me via the submit of a form?Are you able to get a page object back after you submit the form? You can just call "save_as" on the object returned from the form submission. So something like this: form.submit.save_as(''blah.txt'') -- Aaron Patterson http://tenderlovemaking.com/