Member Avatar for yoni0505

Hi there,

I want to learn how to log in to websites using python 3.1, I've searched for any info and couldn't find.

The closest thing I found was an example for older version of python, which I couldn't learn much from it cause the functions are not used in 3.1

the example could be found here: http://bbs.archlinux.org/viewtopic.php?id=61276

So how do I log in a website with python 3.1?

Member Avatar for yoni0505

Check out the following links.

Google
Voidspace

can't you read? I said python 3.1
urllib2 is for older versions, there is no such a thing in python 3.1

oh and I know how to use google btw, maybe even better then you do...
if you would look you would see that your search result are for python 2...

maybe i need to give you a link to a "let me read it for you" site...

I find your comment useless and simply its trolling.

can someone give me an example in python 3.1 how to log in a website?
I saw what that guy made in the forum and its really gave me inspiration, only problem is that his example is in python 2.

oh and I know how to use google btw, maybe even better then you do...

Then you should know that urllib2 has been integrated into urllib in python 3.
http://www.python.org/dev/peps/pep-3108/#urllib-package
http://diveintopython3.org/porting-code-to-python-3-with-2to3.html#urllib

Most of us use python 2.x,because we need 3 party moduls like wxpython,Twisted,dangjo,py2exe...and so on.

No problem to have both python 2.x and python 3.x installed.
Python 3.x is off course the right to go in the future,but for 3 party moduls future is still some years away.

By the way nowone will wirte code for you if you dont show som effort an post what you have done.

Member Avatar for yoni0505

Then you should know that urllib2 has been integrated into urllib in python 3.
http://www.python.org/dev/peps/pep-3108/#urllib-package
http://diveintopython3.org/porting-code-to-python-3-with-2to3.html#urllib

Most of us use python 2.x,because we need 3 party moduls like wxpython,Twisted,dangjo,py2exe...and so on.

No problem to have both python 2.x and python 3.x installed.
Python 3.x is off course the right to go in the future,but for 3 party moduls future is still some years away.

By the way nowone will wirte code for you if you dont show som effort an post what you have done.

I did some stuff, I managed to send a forum using python 3.1 to simple site i've made, and I've tried to read the python 3.1 documentation but its a mess and ain't got what I'm looking for.
I've tried to log in by sending a form but it won't work.
I tried to log in some simple site with a account I made for it and look at the page source I receive, but it still says "welcome guest" (it would say "welcome [username]" if I was logged in) so I know it didn't log in.
I've googled a lot and found out that I need to use cookies and some others libs that python 3.1 doesn't have anymore (found them at that forum I've posted).
I have no clue what to do now or where to look at, there is no tutorials or exmaples for those things in 3.1 and 2.x tutorials are no good...
So I guess the only way to learn it is from someone else who already knows.

The easy way is using 5min to install python 2.x.
And see if you get it to work there,if it work rewrite to python 3.x.

The problem is that very few use python3.x yet.
So getting help with python 3.x is much harder than for python 2.x

I have used 2to3 module to port python 2.x to python 3.x code,and it have work fine for the little i have tryed.
For small script i have not much problem to rewrite to python 3.x

Member Avatar for yoni0505

The easy way is using 5min to install python 2.x.
And see if you get it to work there,if it work rewrite to python 3.x.

The problem is that very few use python3.x yet.
So getting help with python 3.x is much harder than for python 2.x

I have used 2to3 module to port python 2.x to python 3.x code,and it have work fine for the little i have tryed.
For small script i have not much problem to rewrite to python 3.x

I really want to learn python 3, maybe i can try the 2to3.
I think I should listen to your advice and also get python 2, so I'll be able to learn something at all.

I think I should listen to your advice and also get python 2, so I'll be able to learn something at all.

Yes both Guido(python himself) and Alex Martelli say that beginner should start with python 2.x.

They have now hurry to advice pepole to use python 3.x,because is newer.
In some year all will use python 3.x but no need to hurry upp,and refuse all code on net that is for python 2.x(for beginner is this code very important and books to)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.