473,699 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cookie lib policy how-tp?

dear all,

i try to retrieve information from a secure web site. I use cookielib
and urllib2 for this exercise which works to a certain level. I can
authenticate myself and read the top-level page.

However, from here I need to load a page which is dynamically build from
information available from the page source on the top level. The desired
info is inside a <form> tag which seems to be used by a javascript
routine. But when I look at the page source retrieved with urllib2, the
information I need to build the next URL is mssing.

When I use opera to access this page by hand and look at the sources, I
see the full sources when letting opera identify itself as MSIE 6.0.
When using Mozilla 5.0 I get the same in-complete source file as with
python.
The desired info is included in a <form> tag.

Also, when accessing the web page using opera with those two identities,
I'm asked to accept 2 cookies in case of MSIE6.0 and only one for
mozilla. So, I suspect, the problem is somehow related to the cookies
(maybe!?).

I saw, that I can chance the cookie policy in cookielib. Maybe that will
do the job. However, I don't quite understand what I have to do for that.

Any hints or other thoughts are greatly appreciated.

Thanks and cheers,

Riko
Jul 18 '05 #1
6 1700
Riko Wichmann wrote:

When I use opera to access this page by hand and look at the sources, I see the full sources when letting opera identify itself as MSIE 6.0.
When using Mozilla 5.0 I get the same in-complete source file as with python.


Sounds like your first step should be to identify yourself as IE.

opener = urllib2.build_o pener(...)
opener.addheade rs = [("User-Agent", "whatever IE calls itself these
days")]

-Jonathan

Jul 18 '05 #2
Jonathan Ellis wrote:
Riko Wichmann wrote:
When I use opera to access this page by hand and look at the sources,


I
see the full sources when letting opera identify itself as MSIE 6.0.
When using Mozilla 5.0 I get the same in-complete source file as with


python.

Sounds like your first step should be to identify yourself as IE.

opener = urllib2.build_o pener(...)
opener.addheade rs = [("User-Agent", "whatever IE calls itself these
days")]

-Jonathan


Tried that already. At least, I hope I guessed at least one of the
possible identifiers correct: MSIE6.0, MSIE 6.0, MSIE/6.0
Unfortunately no different. I also tried to define my cookiejar as a
MSIE cookiejar. However, since I'm working under Linux, I'm not sure
that even works, even though there was no complain:

#----------------------------
import ClientCookie, urllib

cj = ClientCookie.MS IECookieJar()

self.opener =
ClientCookie.bu ild_opener(Clie ntCookie.HTTPCo okieProcessor(c j))
self.opener.add headers = [('User-Agent', 'MSIE6.0')]
# set login parametes ...
parameters = urllib.urlencod e({"~login" : "XX", "~password" :
"XX"})

f = self.opener.ope n('https:myhost ', parameters)

#----------------------------
Jul 18 '05 #3
Riko Wichmann <ri***********@ remove-this.desy.de> wrote:
Jonathan Ellis wrote:

Sounds like your first step should be to identify yourself as IE.

opener = urllib2.build_o pener(...)
opener.addheade rs = [("User-Agent", "whatever IE calls itself these
days")]

-Jonathan


Tried that already. At least, I hope I guessed at least one of the
possible identifiers correct: MSIE6.0, MSIE 6.0, MSIE/6.0


When my opera is set to identify as MSIE, it sends
"Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.54 [en]".

Saluton
Marc
Jul 18 '05 #4
>>Tried that already. At least, I hope I guessed at least one of the
possible identifiers correct: MSIE6.0, MSIE 6.0, MSIE/6.0

When my opera is set to identify as MSIE, it sends
"Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.54 [en]".


Hi Marc,

thanks for the hint! that brought me a big step forward!

Cheers,

Riko

Jul 18 '05 #5
Riko Wichmann <ri***********@ remove-this.desy.de> wrote:
Tried that already. At least, I hope I guessed at least one of the
possible identifiers correct: MSIE6.0, MSIE 6.0, MSIE/6.0

When my opera is set to identify as MSIE, it sends
"Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.54 [en]".


Hi Marc,

thanks for the hint! that brought me a big step forward!


You're welcome :)
Marc
Jul 18 '05 #6
I think your question has already been answered - but just to clarify a
couple of issues.

Setting a cookie policy will only *restrict* the situations in which
cookies are returned. The default is to *always* return them.

Also using an MSIE instance is useful for creating a CookieJar instance
with your current set of IE cookies in it, but it doesn't make
cookielib behave any more like IE.

(take all that with the usual pinch of salt, but I'm pretty sure it's
correct).

Regards,

Fuzzy
http://www.voidspace.org.uk/atlantib...thonutils.html

Jul 18 '05 #7

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

Similar topics

1
2178
by: Daniel Soderstrom | last post by:
We have a very strange problem that I have not been able to track down. We have a simple cookie being set so people don't have to login to our site everday. However, cookies keep vanishing after a day or two and I havn't been able to work it out. I can actually see the cookie in my "Cookies" folder, however it has a at the end, ie. daniel@www.yoursite.com, when I log into the site again, it creates daniel@www.yoursite.com Server :...
5
1774
by: P. Obbard | last post by:
Hi all, How can I create a privacy policy for a cookie? I have an invisible image loading on a 3rd-party hosted site to help me watch traffic, but the cookie I'm using is being rejected by IE6 browsers on their default Security setting because I lack a privacy policy. How can I add a privacy policy to the cookie I'm creating (with ASP)? Thanks!
7
7196
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local time reaches the set expire-time. But if it is an expire time set on my server in California, and the cookie is put on a computer that is running on London Time, and the expire time is set at the server as 20 minutes from now, the London computer...
7
2142
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but after 6 to 7 hours, the cookie get 2-4 new asp-sessionid's thus overwriting the very first entries in the cookie. Does anyone had the same problem or has a solution. The server is a w2003 enterprise the client has windows xp sp2.
12
4610
by: Jason Shohet | last post by:
I've asked this on the asp ng, but couldn't get any advice, wondering if anyone here can help... GOAL: place a .NET cookie, in a user's cookie folder, containing the machinename of the current machine the user is on. Then various .NET apps will be able to compare a value in our db, and see if the user is allowed to work on that machine. So far, in the computers' startup routine (when the computer is logged into), each computer...
17
4174
by: Bruno | last post by:
I have a feature that is hosted on a different domain from the primary one in a frame, and need to retain values in a cookie. example: A web page at one.com contains a frame which has a page hosted at two.com If I view the frameset from one.com in Firefox, all works well with the content from two.com. But if trying to view this using IE (with standard security settings), the cookie set by two.com is not accessible.
2
1294
by: Eman | last post by:
Greetings to PHP people! I'm acquainted with PHP about five days (more precisely, with the web programming in general). However i have some other experiences in programming. The first thing i need to do is a reliable authentication with sessions and cookies. I've create a scratch web-site for testing this (http://igor.ath.cx:55554/) and have two questions related to cookies. I use the latest PHP 4 & 5
1
1854
by: BJörn Lindqvist | last post by:
Hello, I have some very serious trouble getting cookes to work. After a lot of work (urllib2 is severly underdocumented, arcane and overengineerd btw) I'm finally able to accept cookes from a server. But I'm still unable to return them to a server. Specifically the script im trying to do logs on to a server, get a session cookie and then tries to access a secure page using the same session cookie. But the cookie header cookielib...
2
1176
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Hello, friends, We developed a web site using asp.net 1.1 and Form Authentication. It works ok. However, when our users log into our website through internet, it requires users to reset their IE cookie settings. For example, for IE 6.0 users, a user will have to (1) Click on Tools/Internet Options...,
12
1796
by: Pankaj | last post by:
I have st a cookie that would last for 30 days. If I put a line <img src="http://www.example.com/readcookie.php" width="1" height="1"in a php file, I cannot read the cookie if I use IE7. However, it works in Firefox and Chrome. If I try to access the URL http://www.example.com/readcookie.php in IE7, I am able to read the cookie then. I am using the following lines of code to set the cookie
0
8685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9172
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6532
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.