Am Sonntag, 27. Januar 2008 19:39 schrieb MariusB: > I'm trying to take a link as an argument, open it, read it's content > and then display the first 50 characters from it. > First of all, I've tried to put the code in the views.py, but I didn't > make it. Now I made a middleware component with this code:
No, middleware is not the right place. Use a view. I would use GET (not POST) since you don't modify anything and testing is easier: def url_head(request): c=urllib.urlopen(request.GET['url']) content=c.read() > but the page seems to load forever and I'm stuck! I've read the > chapters from the djangobook, searched on the Internet, but I still > haven't found a solution. Maybe that's a firewall problem. Can you access the page with e.g. wget from the shell? Is there a proxy? Maybe you need to set the http_proxy environment variable. You can try the view by uncommenting urlopen() and c.read() and setting content to a string. HTH, Thomas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---