script detection

Michael Hudson mwh at
Mon Jan 28 08:56:17 EST 2002

cyclotron at (cyclotron) writes:

> Ok thanx,
> I'm fairly new to Python and I don't know anything about browser
> identification. Do I add it with .putheader() ?
> my code looks something like that:
> ------
>         h = httplib.HTTP('')
>         h.putrequest('GET', url)
>         h.putheader('Cookie', 'username=myname%123456789')
>         h.endheaders()
>         errcode, errmsg, headers = h.getreply()
>         f = h.getfile()
>         print( )
> ------
> I get a page where it says something about that my login was
> successful (so I think the cookie part works) but it also says "We
> don't support scripts" in the html code.
> How can I fake the browser identification? I couldn't find useful
> information about it on the net.

You need a h.putheader("User-Agent", something), I believe.

Referrer may be necessary, too.


  If you don't have friends with whom to share links and conversation,
  you have social problems and you should confront them instead of
  joining a cultlike pseudo-community.    -- "Quit Today!"

More information about the Python-list mailing list