download robot

2009-04-12 Thread larryzhang
Hi,
Being a newbie for Python, I am trying to write a code that can act as
a downloading robot.

The website provides information for companies. Manually, I can search
by company name and then click the “download” button to get the data
in excel or word format, before saving the file in a local directory.
The program is to do this automatically.

I have met several problems when writing the codes:
1. The website needs user ID and password, is there a way that I can
pass my ID and password to the server in my python code?
2. Can Python hit the “download” button automatically and choose the
type of file format as I can do manually?
3. The url of each downloading webpage is not unique (webpages point
to different data files may share the same url), which prevent me from
working directly with the url as the address to find a certain file.
Is there any solution for this? Does this mean I have to work directly
with the database stored in the server rather than with the webpage
displayed?

Thank you very much for any comments and suggestions.

Larry
--
http://mail.python.org/mailman/listinfo/python-list


Re: a newbie question

2009-04-12 Thread larryzhang
On Apr 12, 11:01 pm, Peter Otten <__pete...@web.de> wrote:
> zhangle2...@gmail.com wrote:
> > I am just learning Python and get a problem when trying this example:
>
> > from urllib import urlopen
> > doc=urlopen("http://www.python.org";).read()
> > print(doc)
>
> > when i run this, i was tould that 'cannot import name "urlopen"
>
> > What's wrong with this code? Do i need to place my code in some
> > specific directory? Thanks a lot. '
>
> This function has been moved in Python 3.0. Change your import to
>
> from urllib.request import urlopen
>
> If you are learning with a book using Python 2.x consider switching to
> Python 2.5 or 2.6 to try out the examples.
>
> Peter

It works. Thanks a lot Peter.

Larry
--
http://mail.python.org/mailman/listinfo/python-list


Pass ID and password to the server

2009-04-13 Thread larryzhang
Hi,

I am trying to grab webpages from a site that requires user ID and
password, is there a way that I can pass my ID and password to the
server? Thanks.

Larry
--
http://mail.python.org/mailman/listinfo/python-list


authentication example with urllib.request

2009-04-24 Thread larryzhang
Dear all,

I am trying to download data from a website that requires
authentication (maybe with cookies). Any suggestions on how i can do
this with the urllib.request module in py3? Where can I can find some
working examples? Thanks a lot.

Larry
--
http://mail.python.org/mailman/listinfo/python-list