Advertisement

Help finding web based alternative to python

Started by July 25, 2004 05:46 AM
5 comments, last by Kapis 20 years, 4 months ago
Hi I have written a script in python which allows me to filter through 100s of web pages (using the urllib.urlretrieve function) for the information I need. it works perfectly. My main problem, however, is that I have 56k connection and it is quite time consuming. At work I have a broadband connection, but the firewall (or proxy, whatever) doesn't want to give python access to the net. As Internet Explorer can access the net I was wondering if there is a web-based language (which I can open the IE) to perform the same task. IE &#106avascript, CGI, PHP whatever. I have worked with &#106avascript but am not aware of similar function as urlretrieve. I also have zero experience with CGI or PHP. Can someone suggest the easiest alternative. It however must be opened (or runned) within IE. Thanks Talib
Try, try and fucking try again.
As I understand it, the server you got the python script running on isn't allowed outoing http requests. So you would have to do this client side. I don't know if you can get it done with &#106avascript (haven't used that for years), but if it is ok for you to run java applets in your browser, java is a language that is suitable for the task. You can open the program with IE, and it is run client side.
Advertisement
If i understand your problem right, you want to run the python script on your computer at work, but it isn't able to connect to pages in the internet?
Perhaps you can find out, which which proxy your IE uses ( it's in the settings dialog of the internet explorer ) and then change your python script to use the proxy. The urllib.urlretrieve function allows to specify a proxy as parameter.
Sorry. It's not urlretreave, but urlopern where you can specify a proxy.
I tried the urlopen with proxy setting. This however results in returned page by the proxy telling me "cache access denied" .... "cannot authenticate ..... yada yada". Anyway after reading the python help file it states that the proxy setting only works when there is no authentication required. I however have to enter a password to access the net with IE.

As for the Java idea, I might try it as Java apps run perfectly in IE. Will this mean it is time to raise my lazy but and finally start learning Java ... it might be just enough motivation.

Thanks
Talib
Try, try and fucking try again.
Do you have access to a Web server? If so, then you can upload the Python script to a cgi-bin (be sure to rename it so it ends with a .cgi extension) and run it from there.

You might have to do some tinkering, possibly using Web forms (especially if you make extensive use of the interpreter to initialize your script) but it should be doable.

Python has a rather excellent Web interface, just type this:

#!/usr/bin/python (or the path of your server's Python directory)print "Content-Type: text/html\n\n"


and you should be all set. The cgi module in Python is very good at handling forms, and the cgitb module is useful for debugging.
Advertisement
Not sure if Jython could help you. I don't know much about it beyond it's Python running on Java. Maybe it can run inside IE. Just a thought.

This topic is closed to new replies.

Advertisement