added some base templates and basic css etc.

This commit is contained in:
2018-04-19 10:41:07 +01:00
parent 9e4a35ce98
commit 8213a1abd8
7 changed files with 116 additions and 6 deletions

View File

@@ -1,3 +1,36 @@
from django.shortcuts import render
from typing import Union
import requests
from django.contrib.auth.models import User
from django.shortcuts import render
from allauth.socialaccount.providers import eveonline
# Create your views here.
from allauth.socialaccount.models import SocialAccount, SocialToken, SocialApp
from requests.auth import HTTPBasicAuth
def hello(request):
return render(
request,
'base.html',
{}
)
def renew_token(request, account: Union[SocialAccount, User]):
if account is User:
account = SocialAccount.objects.get(user=account)
token = SocialToken.objects.get(account=account)
app = SocialApp.objects.get(provider='eveonline')
req = requests.post(
url='https://login.eveonline.com/oauth/token',
data={
'grant_type': 'refresh_token',
'refresh_token': token.token_secret
},
auth=HTTPBasicAuth(app.client_id, app.secret)
)
token.token = req.json()['access_token']
token.save()