added some base templates and basic css etc.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user