This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/pretend/views/github.py

56 lines
1.7 KiB
Python

"""passbook pretend GitHub Views"""
from django.http import JsonResponse
from django.views import View
class GitHubUserView(View):
"""Emulate GitHub's /user API Endpoint"""
def get(self, request):
"""Emulate GitHub's /user API Endpoint"""
return JsonResponse({
"login": request.user.username,
"id": request.user.pk,
"node_id": "",
"avatar_url": "",
"gravatar_id": "",
"url": "",
"html_url": "",
"followers_url": "",
"following_url": "",
"gists_url": "",
"starred_url": "",
"subscriptions_url": "",
"organizations_url": "",
"repos_url": "",
"events_url": "",
"received_events_url": "",
"type": "User",
"site_admin": False,
"name": "%s %s" % (request.user.first_name, request.user.last_name),
"company": "",
"blog": "",
"location": "",
"email": request.user.email,
"hireable": False,
"bio": "",
"public_repos": 0,
"public_gists": 0,
"followers": 0,
"following": 0,
"created_at": request.user.date_joined,
"updated_at": request.user.date_joined,
"private_gists": 0,
"total_private_repos": 0,
"owned_private_repos": 0,
"disk_usage": 0,
"collaborators": 0,
"two_factor_authentication": True,
"plan": {
"name": "None",
"space": 0,
"private_repos": 0,
"collaborators": 0
}
})