try: # Python 3
from urllib import request as urllib_request
except ImportError: # Python 2
import urllib2 as urllib_request
from django.utils.http import urlencode
def my_view(request):
response = urllib_request.urlopen('https://endpoint/', urlencode({'mytoken': '12345'}))
data = response.read()
# etc
Is CRFS protection enabled ?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/298a8f9d-3694-45f8-88c4-d9049a1e68d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def final_step(request):
code = request.GET['code']
r = requests.post('https://<canvas-install-url>/login/oauth2/token', {'code': code, 'client_id': 'etc'}
access_code = r.json()['access_code']
return HttpResponse('Successfully Logged in! Here's your access_code: %s' % access_code)