[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: sending commands in body of HTTP with urllib2

Astan Chee

1/3/2008 8:43:00 AM

Astan Chee wrote:
> Hi,
> Im trying to implement the logic from
> http://www.hypothetic.org/docs/msn/general/http_conne... to a
> simple python code using urllib2 and some parts of urllib. Im behind a
> http proxy that requires authentication that is why Im using urllib2. Im
> asking for help on how to send commands in a body of a HTTP before
> requesting for response. What am I doing wrong? I only get the response
> from the server but my commands never seem to be acknowledged or
> properly handled.
>
I've tried a httplib implementation for it, and now it keeps giving me
an Error 400 (bad request) / Invalid header name as a response. What am
I doing wrong? is the server depreciated? or not working like the
document describes it? Thanks again for any help. Below is my code


import httplib
import base64
import urllib

USER='user'
PASS='pass'
url =
'http://gateway.messenger.hotmail.com/gateway/gateway.dll?Action=open&Server=NS&IP=messenger.hotmai...

values = 'VER 5 MSNP8 CVR0\r\n'
user_pass = base64.encodestring('%s:%s' %
(urllib.unquote(USER),urllib.unquote(PASS)))
authheader = "Basic %s" % user_pass
proxy_authorization='Proxy-authorization: Basic '+user_pass+'\r\n'

conn = httplib.HTTPConnection("proxy.com.au", 8080)
conn.connect()
conn.putrequest("POST", url)
conn.putheader('Accept','*/*')
conn.putheader('Accept-Language','en-us')
conn.putheader('Accept-Encoding','gzip, deflate')
conn.putheader('User-agent','MSMSGS')
conn.putheader('Host','gateway.messenger.hotmail.com')
conn.putheader('Proxy-Connection','Keep-Alive')
conn.putheader('Pragma','no-cache')
conn.putheader('Content-Type','application/x-msn-messenger')
conn.putheader('content-length',str(len(values)))
conn.putheader('Proxy-authorization',authheader)
conn.endheaders()
conn.send(values)
r = conn.getresponse()
print r.status, r.reason
print r.msg
print r.read()


7 Answers

sheldonlg

4/1/2013 5:06:00 PM

0

On 4/1/2013 12:29 PM, DORIS LADAN wrote:
> SHELLY - THE LAST 2 DAYS OF PESACH ARE HOLY DAYS --
> MAYBE EVERONE IS PRAYING --
>
Doris, these have not been the last two days. TODAY is the seventh day
and TOMORROW is the last day. Where has everyone been since Thursday?
Yesterday, maybe people were busy celebrating Easter :-) ? (That was a
joke).

--
Shelly

DoD

4/1/2013 6:48:00 PM

0

On Apr 1, 12:05 pm, Shelly <sheldo...@thevillages.net> wrote:
> On 4/1/2013 12:29 PM, DORIS LADAN wrote:> SHELLY - THE LAST 2 DAYS OF PESACH ARE HOLY DAYS --
> > MAYBE EVERONE IS PRAYING --
>
> Doris, these have not been the last two days. TODAY is the seventh day
> and TOMORROW is the last day.  Where has everyone been since Thursday?
> Yesterday, maybe people were busy celebrating Easter :-) ?  (That was a
> joke).

It seems like the group has really quieted over the past few months.

topaz

4/2/2013 11:12:00 PM

0

On Apr 1, 1:47 pm, DoD <danskisan...@gmail.com> wrote:
> On Apr 1, 12:05 pm, Shelly <sheldo...@thevillages.net> wrote:
>
> > On 4/1/2013 12:29 PM, DORIS LADAN wrote:> SHELLY - THE LAST 2 DAYS OF PESACH ARE HOLY DAYS --
> > > MAYBE EVERONE IS PRAYING --
>
> > Doris, these have not been the last two days. TODAY is the seventh day
> > and TOMORROW is the last day.  Where has everyone been since Thursday?
> > Yesterday, maybe people were busy celebrating Easter :-) ?  (That was a
> > joke).
>
> It seems like the group has really quieted over the past few months.

Yes indeed it has! I agree

Many new topics and few responses.


Yisroel Markov

4/3/2013 2:28:00 PM

0

On Mon, 1 Apr 2013 17:05:42 +0000 (UTC), Shelly
<sheldonlg@thevillages.net> said:

>On 4/1/2013 12:29 PM, DORIS LADAN wrote:
>> SHELLY - THE LAST 2 DAYS OF PESACH ARE HOLY DAYS --
>> MAYBE EVERONE IS PRAYING --
>>
>Doris, these have not been the last two days. TODAY is the seventh day
>and TOMORROW is the last day. Where has everyone been since Thursday?
>Yesterday, maybe people were busy celebrating Easter :-) ? (That was a
>joke).

I took off the entire Pesakh and have been too busy with the family to
spend much time online.
--
Yisroel "Godwrestler Warriorson" Markov - Boston, MA Member
www.reason.com -- for a sober analysis of the world DNRC
--------------------------------------------------------------------
"Judge, and be prepared to be judged" -- Ayn Rand

sheldonlg

4/3/2013 3:57:00 PM

0

On 4/3/2013 10:27 AM, Yisroel Markov wrote:
> On Mon, 1 Apr 2013 17:05:42 +0000 (UTC), Shelly
> <sheldonlg@thevillages.net> said:
>
>> On 4/1/2013 12:29 PM, DORIS LADAN wrote:
>>> SHELLY - THE LAST 2 DAYS OF PESACH ARE HOLY DAYS --
>>> MAYBE EVERONE IS PRAYING --
>>>
>> Doris, these have not been the last two days. TODAY is the seventh day
>> and TOMORROW is the last day. Where has everyone been since Thursday?
>> Yesterday, maybe people were busy celebrating Easter :-) ? (That was a
>> joke).
>
> I took off the entire Pesakh and have been too busy with the family to
> spend much time online.

Really now, Yisroel? Which was more important :-) ?

--
Shelly

mm

4/3/2013 8:11:00 PM

0

On Wed, 3 Apr 2013 14:27:56 +0000 (UTC), Yisroel Markov
<ey.markov@MUNGiname.com> wrote:

>On Mon, 1 Apr 2013 17:05:42 +0000 (UTC), Shelly
><sheldonlg@thevillages.net> said:
>
>>On 4/1/2013 12:29 PM, DORIS LADAN wrote:
>>> SHELLY - THE LAST 2 DAYS OF PESACH ARE HOLY DAYS --
>>> MAYBE EVERONE IS PRAYING --
>>>
>>Doris, these have not been the last two days. TODAY is the seventh day
>>and TOMORROW is the last day. Where has everyone been since Thursday?
>>Yesterday, maybe people were busy celebrating Easter :-) ? (That was a
>>joke).
>
>I took off the entire Pesakh and have been too busy with the family to
>spend much time online.

That's outrageous. You've got to get your priorities straight.

--

Meir

Harry Weiss

4/9/2013 1:19:00 PM

0

Yisroel Markov <ey.markov@munginame.com> wrote:
> On Mon, 1 Apr 2013 17:05:42 +0000 (UTC), Shelly
> <sheldonlg@thevillages.net> said:

> >On 4/1/2013 12:29 PM, DORIS LADAN wrote:
> >> SHELLY - THE LAST 2 DAYS OF PESACH ARE HOLY DAYS --
> >> MAYBE EVERONE IS PRAYING --
> >>
> >Doris, these have not been the last two days. TODAY is the seventh day
> >and TOMORROW is the last day. Where has everyone been since Thursday?
> >Yesterday, maybe people were busy celebrating Easter :-) ? (That was a
> >joke).

> I took off the entire Pesakh and have been too busy with the family to
> spend much time online.
> --
> Yisroel "Godwrestler Warriorson" Markov - Boston, MA Member
> www.reason.com -- for a sober analysis of the world DNRC
> --------------------------------------------------------------------
> "Judge, and be prepared to be judged" -- Ayn Rand

SAme here. I was away for Pesach and the only posts I saw were those
that were in my e mail for moderation. With 5 of the 8 days being
Shabbat or Yom tov that did not leave much time.



--
Harry J. Weiss
hjweiss@panix.com