~<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hmac | |
import hashlib | |
import json | |
def makeHash(): | |
secret = "zzdfQr_HSb41O-chk9MEDDeLr_snDO3EiEZ6i5IEwZkgEwdF0W3VTtIHIQsEx-TQe1TZHesmcRGnS5Ss9MyCDw" | |
payload = json.dumps( | |
{ | |
"phone_number": "254787876541", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# messages | |
MESSAGE_TAGS = { | |
messages.ERROR: 'danger' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if messages%} {% for message in messages%} | |
<div class="alert alert-{{message.tags}}">{{message}}</div> | |
{%endfor%} {% endif %} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>developers</title> | |
<link | |
rel="stylesheet" | |
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" | |
/> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SWAGGER_SETTINGS = { | |
'USE_SESSION_AUTH': True, | |
'REFETCH_SCHEMA_ON_LOGOUT': True, | |
'LOGIN_URL': '/', | |
'LOGOUT_URL': '/logout', | |
'SECURITY_DEFINITIONS': { | |
'Bearer': { | |
'type': 'apiKey', | |
'name': 'Authorization', | |
'in': 'header' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path('', WelcomeView.as_view(), name='welcome'), | |
path('logout/', LogoutView.as_view(), name='logout'), | |
path('swagger/api.json', schema_view.without_ui(cache_timeout=0), name='schema-json'), | |
path('swagger', schema_view.with_ui('swagger', cache_timeout=0), name='api-documentation'), | |
path('redoc', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import permissions | |
from drf_yasg.views import get_schema_view | |
from drf_yasg import openapi | |
from drf_yasg.generators import OpenAPISchemaGenerator | |
from rest_framework.authentication import SessionAuthentication | |
class CustomOpenAPISchemaGenerator(OpenAPISchemaGenerator): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LogoutView(View): | |
def get(self, request): | |
logout(request) | |
return redirect('welcome') | |
class WelcomeView(View): | |
def get(self, request): | |
if request.user.is_authenticated: | |
return redirect('api-documentation') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AsyncStorage from '@react-native-async-storage/async-storage'; | |
import axios, {AxiosError} from 'axios'; | |
import {logOutUserLocal} from 'redux/actions/auth/logout/clearAllUser'; | |
import store from 'redux/store'; | |
import envs from 'config/env'; | |
// Getting token from local Storage | |
async function getLocalToken() { | |
const token = await AsyncStorage.getItem('token'); | |
return `Bearer ${token}`; |
NewerOlder