-1

I have view that perform particular action after that return i just want to call url and that url will open in the same page

def googleredirect(url):
    return (url)

like in PHP :

header('Location: http://www.example.com/');
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
Deeban Babu
  • 729
  • 1
  • 15
  • 49

3 Answers3

2

If you want to only redirect then use:

# in views.py file
from django.shortcuts import redirect

def some_page(request):
    return redirect('http://www.example.com/')

But if you want to open an URL for screen scraping or some thing else, then use python's own library urllib3 or PyQuery for more better DOM element search

Vin.AI
  • 2,369
  • 2
  • 19
  • 40
0

see here in django

or in python

redirect("http://www.example.com/");
Community
  • 1
  • 1
user3510665
  • 218
  • 3
  • 13
0

If you mean Django-app (@Raptor removed django tag), your view should return an instance of django's HttpResponse

from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse

def google_redirect(request):
    ...
    return HttpResponseRedirect(reverse('app_name:url_name'))
madzohan
  • 11,488
  • 9
  • 40
  • 67