473,405 Members | 2,272 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,405 software developers and data experts.

log in to a website

I'm learning python, and my goal is to write a script that will log
into a website for me. The site uses HTTPS, the form uses the "POST"
method.
From what I've been able to find so far, it looks like i need to use

the urllib2 module...does anyone know where I can find some good sample
code to read up on how to do this?

-Thx

Jul 19 '05 #1
3 1331
You may find the third-party modules "ClientForm" and "ClientCookie" to
be useful.

Using ClientForm, the following code uploads a file to a particular web form:
forms = ClientForm.ParseResponse(urllib2.urlopen(url))
f = forms[0]
f.add_file(open(local, "rb"), filename=remote, name="file")
u = f.click("attach")
urllib2.urlopen(u)

A web search should turn up the homepage for these modules.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFCsdDgJd01MZaTXX0RAn3kAKCLB2/JuT7rdbJ7ZpfYGgNp/uFhmACfZAYx
zJ63Lz+w4ecz539Tcw7StuU=
=UE89
-----END PGP SIGNATURE-----

Jul 19 '05 #2


pa****************@hotmail.com wrote:
I'm learning python, and my goal is to write a script that will log
into a website for me. The site uses HTTPS, the form uses the "POST"
method.
From what I've been able to find so far, it looks like i need to use

the urllib2 module...does anyone know where I can find some good sample
code to read up on how to do this?

-Thx


Is it just BASIC authentication ? (http error code 401).

Clientform is still worth investigating - but if you want help on BASIC
authentication then checkout
http://www.voidspace.org.uk/python/a...tication.shtml

Best Regards,

Fuzzyman
http://www.voidspace.org.uk/python

Jul 19 '05 #3
Works like a gem! Thanks a ton. ClientForm and ClientCookie are great!

Jul 19 '05 #4

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

Similar topics

0
by: ohaya | last post by:
Hi, I've been researching this, and I'm not sure if what I'm trying to do is possible, but I thought that I'd ask: I have two webservers/websites. The first webserver/website is running...
3
by: Newbie | last post by:
I have a C# asp.net webform with a Link Button to a website but it's not opening the website correctly. It's saying "The page cannot be found". But the website is loading when I use IE. Below is...
8
by: jacky kwok | last post by:
Dear All: In VS2005 WebSetup installer InstallAddress dialog, there is field to let user to select which website to install the webapp (if there are more than one WebSite in the IIS). I want...
17
by: stubbsie | last post by:
Hi, I have redesigned our official public government website in .net and it has taken me a few months to redo. I have been the sole designer of the website from its humble beginnning a few years...
2
by: crferguson | last post by:
I'm having a really odd issue. Recently my company has upgraded our data server. For a couple of months I'm having to host two versions of the same website on our webserver until the new data...
19
by: cpnet | last post by:
I'm using VS2005, C#, ASP.NET 2.0. I'm trying to create a report using SQL Reporting Services (to be used in local mode so I don't have to deal with SQL Server). When I create a new report in my...
7
by: Atul | last post by:
Hi Theres a website that books hotels . user enters the information and according to that results are displayed to the user.Let it be website A. Now I want to create a new project with...
3
by: Mintyman | last post by:
Hi, I have 2 fields in a database: 'email' and 'website'. In the majority of cases, the website field is not populated even though the email address is. In 90% of cases, the website will be...
5
by: daveh551 | last post by:
What, from a high level point of view, is the difference (in Visual Studio 2005) between Website (accessed with Open Website or Create Website from the StartPage) that is an ASP.NET Website, and a...
2
by: Wayne Smith | last post by:
Applies to: Visual Studio 2008 Professional Hi everyone, I'm in the middle of creating a website with VS2008 and I'm trying to integrate a user registration/login section on the website but I've...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.