Skip to content

Instantly share code, notes, and snippets.

View CryceTruly's full-sized avatar
🎯
Focusing

cryce truly CryceTruly

🎯
Focusing
View GitHub Profile

Benefits of a Tech Career

  1. Global Job Opportunities

    • Technology transcends borders, offering job opportunities worldwide.
    • Remote positions allow you to work for international companies without relocating.
  2. Flexible Schedules/Remote Work

    • Many tech roles offer the flexibility to work from anywhere.
    • Create a schedule that suits your lifestyle and personal needs.
import hmac
import hashlib
import json
def makeHash():
secret = "zzdfQr_HSb41O-chk9MEDDeLr_snDO3EiEZ6i5IEwZkgEwdF0W3VTtIHIQsEx-TQe1TZHesmcRGnS5Ss9MyCDw"
payload = json.dumps(
{
"phone_number": "254787876541",
# messages
MESSAGE_TAGS = {
messages.ERROR: 'danger'
}
{% if messages%} {% for message in messages%}
<div class="alert alert-{{message.tags}}">{{message}}</div>
{%endfor%} {% endif %}
<html>
<head>
<title>developers</title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
/>
</head>
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'
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'),
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):
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')
~<!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>