473,395 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Seekable output from ClientForm?

Hi,

using python 2.3, ClientForm, and ClientCookie and I have this code:

opener = ClientCookie.build_opener(ClientCookie.HTTPReferer Processor,
ClientCookie.HTTPRefreshProcessor,
ClientCookie.SeekableProcessor)

response = opener.open(lxURL)
forms = ClientForm.ParseResponse(response)
form = forms[0]
response.seek(0)

form['extpatid'] = MyNEUlogin
form['extpatpw'] = MyNEUpassword
formopener = form.click()

response2 = ClientCookie.urlopen(formopener)
guidednews = re.compile("s_guidednews.html")

response2.seek(0)
h = htmllib.HTMLParser(formatter.NullFormatter())
h.feed(response2.read())
print h.anchorlist

Unfortunately, it doesn't work, because response2 was created by
ClientForm and it is not seekable (apparently, I get "AttributeError:
addinfourl instance has no attribute 'seek'").

How to make output of ClientForm seekable, please?

Thanks a lot,

Matej
Jul 18 '05 #1
2 1650
mac
In article <35*************************@posting.google.com> , Matej Cepl wrote:
Hi,

using python 2.3, ClientForm, and ClientCookie and I have this code:

opener = ClientCookie.build_opener(ClientCookie.HTTPReferer Processor,
ClientCookie.HTTPRefreshProcessor,
ClientCookie.SeekableProcessor)

response = opener.open(lxURL)
forms = ClientForm.ParseResponse(response)
form = forms[0]
response.seek(0)

form['extpatid'] = MyNEUlogin
form['extpatpw'] = MyNEUpassword
formopener = form.click()

response2 = ClientCookie.urlopen(formopener)

guidednews = re.compile("s_guidednews.html")

response2.seek(0)
h = htmllib.HTMLParser(formatter.NullFormatter())
h.feed(response2.read())
print h.anchorlist

Unfortunately, it doesn't work, because response2 was created by
ClientForm and it is not seekable (apparently, I get "AttributeError:
addinfourl instance has no attribute 'seek'").

How to make output of ClientForm seekable, please?


Instead of:
response2 = ClientCookie.urlopen(formopener)
try:
opener.open(formopener)

Cheers,
Maciek

Jul 18 '05 #2
Thanks a lot!

Matej

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: narke | last post by:
Does anyone here use ClientForm to handle a HTML form on client side? I got a form, within which there is a image control, it direct me to another page if i use mouse click on it. the code of...
0
by: kostem | last post by:
Hi, I need some help on using ClientForm to post to cgi and getting response. I have done this many times and it worked very well until now. I have contacted the webmaster of the page I'm...
0
by: m0sf3t | last post by:
Does anyone here use ClientForm to handle a HTML form on client side? I try to open this page https://www.orange.ch/footer/login but got this message File...
0
by: Joe Johnson | last post by:
Greetings, I just did a fresh install of Solaris 10 on Sparc. The OS ships with perl_5.8.4. When I run some of my scripts that run fine on Linux, I get this: IO::Seekable::getpos missing at...
0
by: dany_gates | last post by:
hi, Need some help on Network Streams in .NET. I m planning to build a .NET application which mimicks Download Accelerator Plus (DAP:famous downloading application). So naturally i want to...
6
by: Hardy Wang | last post by:
Hi all: The Stream object from WebRequest.GetResponseStream() is non-seekable. How can I convert this stream to a byte array? For ordinary Stream (seekable), I can use...
0
by: emiliano | last post by:
Hey guys, i was just googling some information about how to use the ClientForm package with a page which requires HTTP basic authentication and i got here :P ... So here is the problem, lets see if...
1
by: Gordon Airporte | last post by:
I've written a script using ClientForm to automate opening and closing ports on my Linksys router. It works, but I wonder if there isn't a better way to do it. The problem is that the list of...
2
by: hp1980 | last post by:
Hi, I'm writing a web automation script using ClientForm and urlgrabber. I use urlgrabber because I need the "http keepalive" which doesn't exist in urllib2. I'm facing a problem, the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.