How can i find the form name without "nr=0"

2007-11-05 Thread scripteaze
Im using mechanize method for retrieving the form so that i may log
into it. I need to find a way to get the form name. Its not listed
anywhere in the html source.The reason i need to do this is because im
tryin not to use the for loop below. Someone told me that the form
name should be listed in the 'print form' portion of the codes output.
I dont believe the form name is listed there also. Any ideas/help
would be great. Thank you in advance for your time.

for form in self._br.forms():
print form
self._br.select_form(nr=0)
self._br['username'] = Crawler.usrname
self._br['password'] = line.strip()
response=self._br.submit()
if 'incorrect' in response.read():
print 'password incorrect =', line.strip()


this is the output of 'print form'

https://somesite.com/login.html application/x-www-form-
urlencoded
  
  
  =Secure Login) (readonly)>
  >

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can i find the form name without "nr=0"

2007-11-05 Thread scripteaze
On Nov 5, 8:52 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> scripteaze wrote:
> > Im using mechanize method for retrieving the form so that i may log
> > into it. I need to find a way to get the form name. Its not listed
> > anywhere in the html source.The reason i need to do this is because im
> > tryin not to use the for loop below. Someone told me that the form
> > name should be listed in the 'print form' portion of the codes output.
> > I dont believe the form name is listed there also. Any ideas/help
> > would be great. Thank you in advance for your time.
>
> > for form in self._br.forms():
> > print form
> > self._br.select_form(nr=0)
> > self._br['username'] = Crawler.usrname
> > self._br['password'] = line.strip()
> > response=self._br.submit()
> > if 'incorrect' in response.read():
> > print 'password incorrect =', line.strip()
>
> How do you expect the form to be named if there is no name given in the HTML
> source?
>
> Diez- Hide quoted text -
>
> - Show quoted text -

Well, i wasnt sure if you could have a form without a form name, i was
just thinking that it had one but maybe hidden and that i could
retrieve it

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can i find the form name without "nr=0"

2007-11-05 Thread scripteaze
 b> > Well, i wasnt sure if you could have a form without a form name,
i was
> > just thinking that it had one but maybe hidden and that i could
> > retrieve it
>
> How hidden? HTML source is ... THE source. there is nothing hidden in there.
>
Is it possible then to have a form with no name and if so, how can i
access this form

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can i find the form name without "nr=0"

2007-11-05 Thread scripteaze
On Nov 5, 6:33 pm, alex23 <[EMAIL PROTECTED]> wrote:
> On Nov 6, 8:56 am, scripteaze <[EMAIL PROTECTED]> wrote:
>
> > Is it possible then to have a form with no name and if so, how can i
> > access this form
>
> Hey scripteaze,
>
> I'm not sure about mechanize, but you might have more success using
> another one of the author's modules, 
> ClientForm:http://wwwsearch.sourceforge.net/ClientForm/
>
> from urllib2 import urlopen
> from ClientForm import ParseResponse
>
> response = urlopen("http://wwwsearch.sourceforge.net/ClientForm/
> example.html")
> forms = ParseResponse(response, backwards_compat=False)
> form = forms[0]
>
> As it returns a list of forms, you don't need to have a name to access
> it.
>
> Hope this helps.
>
> -alex23

Thank you very much for your reply. Ill check it out.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can i find the form name without "nr=0"

2007-11-07 Thread scripteaze
On Nov 7, 1:35 pm, [EMAIL PROTECTED] (John J. Lee) wrote:
> alex23 <[EMAIL PROTECTED]> writes:
> > On Nov 6, 8:56 am, scripteaze <[EMAIL PROTECTED]> wrote:
> >> Is it possible then to have a form with no name and if so, how can i
> >> access this form
>
> > Hey scripteaze,
>
> > I'm not sure about mechanize, but you might have more success using
> > another one of the author's modules, 
> > ClientForm:http://wwwsearch.sourceforge.net/ClientForm/
>
> > from urllib2 import urlopen
> > from ClientForm import ParseResponse
>
> > response = urlopen("http://wwwsearch.sourceforge.net/ClientForm/
> > example.html")
> > forms = ParseResponse(response, backwards_compat=False)
> > form = forms[0]
>
> > As it returns a list of forms, you don't need to have a name to access
> > it.
>
> mechanize forms are ClientForm forms.
>
> Quoting from mechanize.Browser.select_form().__doc__:
>
> """
> Another way to select a form is to assign to the .form attribute.  The
> form assigned should be one of the objects returned by the .forms()
> method.
> """
>
> forms = list(br.forms())
> br.form = pick_a_form(forms, br.global_form())
>
> The "global form" (couldn't think of a better term) consists of all
> form controls not contained in any FORM element.
>
> John- Hide quoted text -
>
> - Show quoted text -

Thank you guys for replying, im sure that one of these methods will
suffice, after this project, im definatly going to do more in lui of
web apps for learning..Thanks again

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python iPod challenge

2007-11-08 Thread scripteaze
On Nov 8, 2:21 am, [EMAIL PROTECTED] wrote:
> Hi!
>a friend and me are investigating how mother-tongue influences
> programming productivity.
>We need volunteers to take on  a 3 minutes python language
> programming test.
>if you are interested please be so kind to visit:
>
>  http://test-iq.web.cern.ch/test-iq/step1.php?lang=en
>
>if your native language is Spanish please do it in Spanish
> language. Beginners particularly welcome
>
> Thanks!
>
> jose berengueres

Well, just out of curosity, i started the test, however, it seems a
little bugy. My answer to the first question one was:


text = 'In principio creavit Deus caelum et terram. Terra autem erat'
count = 0
for char in text:
  if char == 'a':
count = count + 1
print 'the letter a appears',count ,'times.'


getting the following error:

SYNTAX ERROR Check line 3 text = 'In principio creavit Deus caelum et
terram. Terra autem erat' ^

Im not sure but i think you are looking for only one method of getting
the answer, however, there are several ways to achieve it, so, im
done..lol, no offense, but if im going to fail the test, i want to
fail because i  did it wrong and not because i did it different..




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python To Change The World :)

2007-11-14 Thread scripteaze
On Nov 14, 7:42 am, Scott David Daniels <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > my objective is to replicate a section of los angeles using python,
> > and program the street lights and cars and whatnot. Should I be
> > looking towards 3D to do this?
>
> > so here is MY question:
> > how would you replicate a street intersection in python? and
> > furthermore, how would you do you have the cars move up and down those
> > "streets".
>
> > my question to YOU is:
> > can you point me in the right direction? I will search on my own, but
> > I would greatly appreciate any help :)
>
> If you do want to do this in 3-D, try out VPython.  More than any other
> 3-D system I've seen, it allows you to concentrate more on your problem,
> and let it handle most of the 3-D rendering calculations as you are
> learning how to use it.
>
> -Scott David Daniels
> [EMAIL PROTECTED]

Although, i am quite the python noob, pygame would be the way to go

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is python?????

2007-11-17 Thread scripteaze
On Nov 17, 12:19 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> On Nov 17, 10:00�am, Neil Cerutti <[EMAIL PROTECTED]> wrote:
>
>
>
> > On 2007-11-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > On Nov 16, 3:10?pm, Alan <[EMAIL PROTECTED]> wrote:
> > >> On Nov 16, 8:29 pm, [EMAIL PROTECTED] wrote:
>
> > >> > I still don't get it and I've been haunting this group for months...
>
> > >> > Mike
>
> > >> Go on then ?...
>
> > >> What ?
>
> > >> The punchline, do the punchline
>
> > > Punchline? I don't think there's a punchline scheduled, is
> > > there? Where are we? A week 39.4 ...no, it's Friday, isn't it -
> > > 39.7. Oh...here we are. Oh! Ha, ha, ha, very good. Ha, ha, ha,
> > > very good. What a good punchline. Pity we missed that.
>
> > def punchline():
> > � return random.choice(['What's all this, then?',
> > � � � � � � � � � � � � 'Do you want to come back to my place?',
>
>                           'that you were willfully and persistently
>                            a foreiner'])
>
>
>
>
>
> > --
> > Neil Cerutti- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

ni!
-- 
http://mail.python.org/mailman/listinfo/python-list

speed versus threading or asyncore

2007-12-14 Thread scripteaze
I need some examples on using asycore for a client app im creating. I
need to be able to connect to my server 10 times and i dont want any
lag nor my cpu to be taxed.

The examples ive found are for the server and i dont know how to
implement asyncore on the client.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Suggested Reading

2007-12-16 Thread scripteaze
On Dec 16, 1:47 am, Thin Myrna <[EMAIL PROTECTED]> wrote:
> Benoit wrote:
> > I got myself into programming late in the summer and have dabbled in
> > python for the most part in that time, recently beginning work on a
> > music player.  In January, I start my minor in Information
> > Technology.  I'd like to get ahead a bit, however, and over the break
> > would like to do some reading. I seek your recommendations in the
> > field of database design basics and network programming, with a bias
> > towards texts which specifically address Python.  By network
> > programming, I mean fundamental understanding of sockets, TCP/UDP,
> > right up to HTTP serving, etc.  Thanks ahead of time.
>
> Steve Holden's Python Web Programming might be what you are looking for.
> It covers all the topics needed to deal with sockets, databases, up to
> building complete web apps. One of my books I'd never give away.
>
> HTH
> Thin

urls
http://docs.python.org/lib/module-socket.html
http://www.amk.ca/python/howto/sockets/
http://www.devshed.com/c/a/Python/Sockets-in-Python/

books
http://www.amazon.com/Foundations-Python-Network-Programming/dp/1590593715

you might also want to read up on twisted, (just for the heck of it)
http://twistedmatrix.com/trac/
-- 
http://mail.python.org/mailman/listinfo/python-list


sending a rip1 request via python

2007-12-19 Thread scripteaze
ok, im new to this sort of coding so excuse me if im not exactly sure
as to what i need to pull this off.

I need to be able to send a rip1 request to my rip1 enabled device.,
so i need python to send :

01 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
10

which is an RIP1 request and then have it respond back to me. im not
to worried about the returned format, but is there anyway to do this
in just a few lines of python?

i was looking at this page for ideas:

http://www.larsen-b.com/Article/206.html

its just one of the few google responses for : sending packets with
python.

any responses welcome, thanks :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sending a rip1 request via python

2007-12-19 Thread scripteaze
On Dec 19, 10:34 am, Dirk Loss <[EMAIL PROTECTED]> wrote:
> scripteaze wrote:
> > I need to be able to send a rip1 request to my rip1 enabled device.,
> > so i need python to send :
> > 01 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 10
>
> Use Scapy:
>
> from scapy import *
> myrip = RIP()/RIPEntry(metric=16)
> ans, unans = sr(IP(dst="192.168.1.1")/UDP(sport=520)/myrip)
>
> http://www.secdev.org/projects/scapy/
>
> Regards
> Dirk

Well, i use scapy quite often, however, this needs to be very portable
from one box to another with out the installation of extra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sending a rip1 request via python

2007-12-19 Thread scripteaze
On Dec 19, 5:14 pm, scripteaze <[EMAIL PROTECTED]> wrote:
> On Dec 19, 10:34 am, Dirk Loss <[EMAIL PROTECTED]> wrote:
>
>
>
> > scripteaze wrote:
> > > I need to be able to send a rip1 request to my rip1 enabled device.,
> > > so i need python to send :
> > > 01 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > > 10
>
> > Use Scapy:
>
> > from scapy import *
> > myrip = RIP()/RIPEntry(metric=16)
> > ans, unans = sr(IP(dst="192.168.1.1")/UDP(sport=520)/myrip)
>
> >http://www.secdev.org/projects/scapy/
>
> > Regards
> > Dirk
>
> Well, i use scapy quite often, however, this needs to be very portable
> from one box to another with out the installation of extra

I was not finished, lol, for some reason my keyboard went haywire and
did its own thing. Anywho, scapy is out of the question. any code
examples? and also, whats the alternative.

thanks in advance
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sending a rip1 request via python

2007-12-20 Thread scripteaze
On Dec 19, 5:50 pm, Dirk Loss <[EMAIL PROTECTED]> wrote:
> scripteaze wrote:
>
>  >>> I need to be able to send a rip1 request to my rip1 enabled device.,
ok i got everthing setup and its sending the packets, do i have to
create a socket server or cant i simply setup a buf = 1024 and recieve
the replies and display them, i dont need to interact, just view the
returned data if any, thanks

>
 > Well, i use scapy quite often, however, this needs to be very
portable
>
> import socket
> rip_request = '\x01\x01\x00\x00\x00\x02' + '\x00' * 17 + '\x10'
> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
> s.sendto(rip_request, ("servername", 520))
> s.close()
>
> If you also want to handle the replies, you might want to have a look at
> the SocketServer module:
>
> http://docs.python.org/lib/module-SocketServer.html
>
> Regards
> Dirk

-- 
http://mail.python.org/mailman/listinfo/python-list


http proxy question

2007-12-28 Thread scripteaze
I am tryin to grab a file from a site, however, this site limits me to
one file per 15 minutes. What im tryin to do is use http profies in my
script to just grab the file then change proxies so i can do it again
back to back so that site site does not block me. This possible any
example code out there?


Thank you in advance
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SendKeys-0.3.win32-py2.1.exe

2008-11-08 Thread scripteaze
On Oct 26, 9:01 am, Thorsten Kampe <[EMAIL PROTECTED]> wrote:
> * Jesse (Sat, 25 Oct 2008 14:33:52 -0700 (PDT))
>
> > cant seem to install this, using python 2.6, any known errors that
> > wont let me select the python installation to use, just opens a blank
> > dialog and wont let me continue..do i need to downgrade python??
>
> Well, you could. But honestly, this is more like an IQ test. Reflect
> about what you have done, reflect about the file name you are trying to
> install and then finally go to SendKeys' web site and see if you find
> enlightenment.
>
> Thorsten

very funny, however, i, at first glance, did not know that
SendKeys-0.3.win32-py2.1.exe was for python version 2.1,I simply
thought that it was part of the version of sendkey., either way,
hahah, im a dumbass.

If you laugh with others about yourself, they will laugh with you and
not at you.
--
http://mail.python.org/mailman/listinfo/python-list