def callback(request):
    '\n    GitHub redirect here, then retrieves token for API\n\n    arguments:\n        :request: GET HTTP request\n\n    returns:\n        Redirects to index\n    '
    code = request.GET.get('code')
    payload = {'client_id': GITHUB_CLIENT_ID, 'client_secret': GITHUB_CLIENT_SECRET, 'code': code}
    headers = {'accept': 'application/json'}
    res = requests.post(GITHUB_OATH_ACCESS_TOKEN_PATH, data=payload, headers=headers)
    request.session['github_token'] = res.json()['access_token']
    request.session['github_info'] = github_util.get_user_info(request.session['github_token'])
    return HttpResponseRedirect(reverse('index'))
GitHub redirect here, then retrieves token for API

arguments:
    :request: GET HTTP request

returns:
    Redirects to index
def callback(request):
    '\n    GitHub redirect here, then retrieves token for API\n\n    arguments:\n        :request: GET HTTP request\n\n    returns:\n        Redirects to index\n    '
    code = request.GET.get('code')
    payload = {'client_id': GITHUB_CLIENT_ID, 'client_secret': GITHUB_CLIENT_SECRET, 'code': code}
    headers = {'accept': 'application/json'}
    res = requests.post(GITHUB_OATH_ACCESS_TOKEN_PATH, data=payload, headers=headers)
    request.session['github_token'] = res.json()['access_token']
    request.session['github_info'] = github_util.get_user_info(request.session['github_token'])
    return HttpResponseRedirect(reverse('index'))