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

extra gibberish interspersed into urllib2 output


I'm attempting to retrieve some data from an http server using basic auth
via python 2.3 with the urllib2 and cookielib modules.

I'm finding that I'm getting the data I need, but unfortunately, there are
small bits of gibberish interspersed in it, rendering the data difficult
to use at best. For example:

p06,128.200.73.146,foobar,,,,,ES Servers,,li,,,,,
p07,128.200.73.147,foobar,,,,,
ffb
ES Servers,,li,,,,,
webmail2,128.200.224.22,foobar ,,,,,ES Servers,,li,blackhole:1,,,,

IOW, that "ffb" does not belong in the middle of the 2nd line of what
should be a 3 line snippet. There are also some spurious carriage returns
in there I believe, which may not show up in this message.

Has anyone seen this before? Is it premature to start using urllib2 from
python 2.4? Is it a bad idea to use this 2.4 module on python 2.3?

BTW, when I cut out the cookielib stuff, I still get the same strange
results.

On a bit of a bizarre note, mozilla is also unable to display this page,
however mozilla simply shows no content instead of adding in nonsense.
links (the text mode web browser) however displays the content of the page
just as it should.

TIA for any suggestions you can offer.
Jul 18 '05 #1
2 1202
Dan Stromberg wrote:
I'm attempting to retrieve some data from an http server using basic auth
via python 2.3 with the urllib2 and cookielib modules.

I'm finding that I'm getting the data I need, but unfortunately, there are
small bits of gibberish interspersed in it, rendering the data difficult
to use at best. .. Has anyone seen this before? Is it premature to start using urllib2 from
python 2.4? Is it a bad idea to use this 2.4 module on python 2.3?


I've been using urllib2 under Python 2.4 and not seen
problems. The code hasn't changed much in years, that
I know.

Have you tried doing the request manually? That is,

%telnet machine 80
GET /asdf HTTP/1.0
..put cookie and auth information here..
Doing that would help show the problem is coming from
upstream of Python (or that it's in Python).

To go real hard core you could get ethereal or some
other network sniffer and watch exactly what Python
does. That's easier in some sense because you don't
need to figure out what to send for the request headers.
Andrew
da***@dalkescientific.com
Jul 18 '05 #2
Dan Stromberg wrote:
I'm finding that I'm getting the data I need, but unfortunately, there are
small bits of gibberish interspersed in it, rendering the data difficult
to use at best. For example:

p06,128.200.73.146,foobar,,,,,ES Servers,,li,,,,,
p07,128.200.73.147,foobar,,,,,
ffb
ES Servers,,li,,,,,
webmail2,128.200.224.22,foobar ,,,,,ES Servers,,li,blackhole:1,,,,

IOW, that "ffb" does not belong in the middle of the 2nd line of what
should be a 3 line snippet. There are also some spurious carriage returns
in there I believe, which may not show up in this message.


someone reported a similar problem on the XML-SIG a while ago.

in that case, like in this case, the extra characters are hexadecimal
numbers, which could mean that urllib, or some server out there,
isn't handling HTTP chunking properly:

http://www.w3.org/Protocols/rfc2616/....html#sec3.6.1

</F>

Jul 18 '05 #3

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

Similar topics

0
by: Jacek Trzmiel | last post by:
Hi, I have a problem with using urllib2 with threading module under Cygwin. $ cygcheck -cd cygwin python Cygwin Package Information Package Version cygwin 1.5.5-1...
0
by: jacob c. | last post by:
When I request a URL using urllib2, it appears that urllib2 always makes the request using HTTP 1.0, and not HTTP 1.1. I'm trying to use the "If-None-Match"/"ETag" HTTP headers to conserve...
0
by: Gil Tal | last post by:
Hi, I use urllib2 to download a redirected url and I get an exception from the bowels of urllib2. It seems that urllib2 implements some super sophisticated self check and tries to control the...
7
by: itay_k | last post by:
Hi, I dont understand why this is so complicated, just to add one line of cookie header on the GET request. This is my unworking code: import time import Cookie import cookielib, urllib2
3
by: jnair | last post by:
Hi , I am using python2.4 "urllib2" and "cookelib". In line "5" below i provide my credentials to login into a web site.During the first attempt i "fail", judging from the output of line "6"....
1
by: jnair | last post by:
Hi , I am using python2.4 "urllib2" and "cookelib". In line "5" below i provide my credentials to login into a web site.During the first attempt i "fail", judging from the output of line "6"....
1
by: Ben Edwards | last post by:
Have been experimenting with HTTP stuff in python 2.4 and am having a problem getting debug info. If I use utllib.utlopen I get debug but if I user utllib2 I do not. Below is the probram and the...
3
by: m.banaouas | last post by:
Hi all, I started to use urllib2 library and HTTPBasicAuthHandler class in order to authenticate with a http server (Zope in this case). I don't know why but it doesn't work, while authenticating...
1
by: darran | last post by:
I'm struggling with using urllib2 to access the Harvest time-tracking web service (http://www.getharvest.com/api). GET is working fine. POST is giving me a problem. Here is an example that...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.