Skip to content

Instantly share code, notes, and snippets.

View skolo-online's full-sized avatar

Skolo Online Learning skolo-online

View GitHub Profile
@skolo-online
skolo-online / codexFlask.py
Created January 31, 2022 08:01
Flask Application Generated by Codex
import requests
from flask import Flask, render_template, request
app = Flask(__name__)
# Get the news stories
api_key = None
base_url = None
def configure_request(app):
@skolo-online
skolo-online / landing-page-model.py
Created September 17, 2022 14:10
Landing page model
from django.db import models
from django.template.defaultfilters import slugify
from django.contrib.auth.models import User
from django.utils import timezone
from uuid import uuid4
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
@skolo-online
skolo-online / landing-page-prompt.py
Created September 17, 2022 14:49
Landing Page Prompts
import os
import openai
from django.conf import settings
openai.api_key = settings.OPENAI_API_KEY
def returnSection1Title(businessDo):
response = openai.Completion.create(
@skolo-online
skolo-online / landing-page-views.py
Last active September 17, 2022 15:16
Landing page views
from django.shortcuts import render, redirect
from .models import *
from .aigenerator import *
from .functions import *
from django.contrib import messages
from django.conf import settings
import time
def home(request):
@skolo-online
skolo-online / landing-page-functions.py
Created September 17, 2022 15:17
Landing page functions
from .aigenerator import *
def getDescription(businessName, businessDo, length):
description = returnSection1Description(businessName, businessDo)
if len(description) < length:
return description
else:
desc_list = description.split('.')
@skolo-online
skolo-online / landing-page-index.html
Created September 17, 2022 15:29
Landing Page Index File
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Skolo Online</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
</head>
<body>
<div class="container">
@skolo-online
skolo-online / landing-page-website.html
Created September 17, 2022 15:33
Landing Page Website HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>{{businessName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" />
<meta content="Themesbrand" name="author" />
@skolo-online
skolo-online / send_Whatsapp_message.py
Created January 3, 2023 15:16
Send a WhatsApp message
import requests
phoneNumber = '27738892232'
message = 'Hello there, this was sent from Django'
token = 'Bearer xxxxx-your-whatsapp-token-goes-here-xxxxxxxxxxxx'
url = 'https://graph.facebook.com/v15.0/110244361711861/messages'
def sendWhastAppMessage(phoneNumber, message):
headers = {"Authorization": token}
@skolo-online
skolo-online / receive_whatsapp_message.py
Created January 3, 2023 15:26
Receive WhatsApp Message via webhook
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
import json
@csrf_exempt
def whatsAppWebhook(request):
if request.method == 'GET':
VERIFY_TOKEN = 'enter-your-verify-token-here'
mode = request.GET['hub.mode']
@skolo-online
skolo-online / whatsapp_chat_model.py
Created January 3, 2023 17:11
Whatsapp Business Plan Chat Model
from django.db import models
from django.utils import timezone
from uuid import uuid4
class ChatSession(models.Model):
OPTIONS = [
('(Pty) Ltd', '(Pty) Ltd'),
('Not Profit', 'Not Profit'),