Framework to make using Bottle less time-consuming and easier

Overview

Astatine API

Made by tygzy - https://github.com/tygzy

A class for the Bottle API to reduce clutter and difficulty while creating a website.

Summary of features:

  • When adding a file to your html file e.g. CSS you only need to provide the filepath past the 'css' directory, if the css file is in that main directory you only need to provide the file name.
    • This is the same if you use a file inside your CSS e.g. an svg reference you only need to provide the file name unless the file is embedded further in the directory.
    • This is also the case for other file types such as .js .css .scss .svg .jpg .png .ttf .eot .ttf .woff .woff2.
  • All basic website directories will be made when you call the class for the first time if the directories don't already exist.
  • To use sessions(cookies) the 'enable_sessions()' function, this needs to be called otherwise sessions won't be enabled.
  • For allowing a user to download a file make a link with the route '/download/'.
  • When uploading a file to the web server, it will automatically upload to /views/data.
  • The base class also allows the use of SQLite3 with ease, requiring no setup, just use the modify_SQL() and return_SQL() functions to interact with your database.
  • A function that allows the creation of a UUID, which checks in a provided table whether that UUID already exists to make sure it is unique.

Examples

404 Error!" if __name__ == '__main__': web = Website() web.astatine.run_astatine() ">
class Website(object):
    def __init__(self):
        debug = True
        reload = True
        port = 8080
        host = "localhost"
        self.astatine = Astatine(host, port, debug, reload)
        self.astatine.enable_sessions()
        self.create_routes()

    def create_routes(self):
        self.astatine.add_route('/', 'GET', self.index, True)
        self.astatine.add_error_handler(404, self.error_page)

    def index(self, session):
        return template('html/index.tpl', session=session)

    def error_page(self, error):
        return "

404 Error!

" if __name__ == '__main__': web = Website() web.astatine.run_astatine()

This will create a basic website with an index page and also handle a 404 error, which may seem like a lot of code, but this allows much easier code writing further on in development. With using static files, interacting with a database, using sessions and uploading files.

Error handling.

# You can use this:
self.astatine.add_error_handler(404, self.error_page)

# Or this to handle multiple kinds of errors all in one function
self.astatine.add_error_handler([400, 401, 402, 403, 404], self.error_page)

The two methods of interacting with an SQLite3 database.

results = self.astatine.return_SQL("SELECT * FROM table WHERE NOT id = ? LIMIT 3", (1,))

self.astatine.modify_SQL("INSERT INTO table (id, name, age) VALUES (?,?,?)", (1, "tygzy", 18))

How to upload a file using Bottle Base API.

self.astatine.upload_file(bottle_file=file, allowed_exts=('.jpg', '.png'), file_dir='img/', overwrite=True)
Owner
Tygzy
Intermediate knowledge in Python, Java, JavaScript, SQLite3, and knowledge in markup.
Tygzy
A tool that helps keeping track of your AWS quota utilization

aws-quota-checker A tool that helps keeping track of your AWS quota utilization. It'll determine the limits of your AWS account and compare them to th

Max 63 Dec 14, 2022
Flood discord webhooks

Webhook-Spammer Flood discord webhooks Asynchronous webhook spammer Fast & Efficient Usage - Use it with atleast 500 threads Put a valid webhook Use a

trey 1 Apr 22, 2022
A Anything goes Discord bot written in python and uses the wrapper Discord.py

GerardTheWizard A Anything goes Discord bot written in python and uses the wrapper Discord.py What can he do? Allow users to level up through typing,

1 May 05, 2022
A twitter multi-tool for OSINT on twitter accounts.

TwitterCheckr A twitter multi-tool for OSINT on twitter accounts. Infomation TwitterCheckr also known as TCheckr is multi-tool for OSINT on twitter a

IRIS 16 Dec 23, 2022
Aio-binance-library - Async library for connecting to the Binance API on Python

aio-binance-library Async library for connecting to the Binance API on Python Th

GRinvest 10 Nov 21, 2022
Extrait les informations contenues dans le code QR de la preuve de vaccination générée par le gouvernement du Québec

DecodeurPreuveVaccinationQC Extrait les informations contenues dans le code QR de la preuve de vaccination générée par le gouvernement du Québec Utili

Guillaume Morissette 8 Jul 26, 2022
Gorrabot is a bot made to automate checks and processes in the development process.

Gorrabot is a Gitlab bot made to automate checks and processes in the Faraday development. Features Check that the CHANGELOG is modified By default, m

Faraday 7 Dec 14, 2022
A Rich renderable for viewing Multiple Sequence Alignments in the terminal.

rich-msa A simple module to render colorful Multiple Sequence Alignment with rich in the terminal. 🔧 Installing Install the rich-msa package directly

Martin Larralde 64 Dec 04, 2022
Integrating the Daraja-Api with Python language

Mpesa-Daraja-Api Integrating the Daraja-Api with Python language. Credentials.py file This file contains the consumer key and the consumer secrete key

Morvin Ian 3 Nov 09, 2022
Drcom-pt-client - Drcom Pt version client with refresh timer

drcom-pt-client Drcom Pt version client with refresh timer Dr.com Pt版本客户端 可用于网页认

4 Nov 16, 2022
An api, written in Python, for Investopedia's paper trading stock simulator.

investopedia-trading-api An API, written in Python, for Investopedia's paper trading stock simulator. Pull requests welcome. This library is now Pytho

Kirk Thaker 178 Jan 06, 2023
A Telegram bot to transcribe audio, video and image into text.

Transcriber Bot A Telegram bot to transcribe audio, video and image into text. Deploy to Heroku Local Deploying Install the FFmpeg. Make sure you have

10 Dec 19, 2022
PHION's client-side core python library

PHION-core PHION's client-side core python library. This library is not meant to be used directly by users. If you want to install phion please use th

PHION 2 Feb 07, 2022
Singer Tap for dbt Artifacts built with the Meltano SDK

tap-dbt-artifacts tap-dbt-artifacts is a Singer tap for dbtArtifacts. Built with the Meltano SDK for Singer Taps.

Prratek Ramchandani 9 Nov 25, 2022
Zaid Vc Player Allows u to steam Songs/music on vc chat

ᴢᴀɪᴅ ᴠᴄ ᴘʟᴀʏᴇʀ 🔥 SORRY FOR OUR PROJECTS DELETED BY GITHUB FLAGGED ᴢᴀɪᴅ ᴠᴄ ᴘʟᴀᴇʀ ɪꜱ ᴀ ᴛᴇʟᴇɢʀᴀᴍ ᴘʀᴏᴊᴇᴄᴛ ʙᴀꜱᴇᴅ ᴏɴ ᴘʏʀᴏɢʀᴀᴍ ꜰᴏʀ ᴘʟᴀʏ ᴍᴜꜱɪᴄꜱ ɪɴ ᴠᴄ ᴄʜᴀᴛꜱ..

Zaid 117 Dec 29, 2022
GBSLocalLauncher - A script to compose ENV file for Local Compose

GBSLocalLauncher This is a script to compose ENV file for Local Compose. It crea

2 Jan 27, 2022
Music bot for Discord

Treble Music bot for Discord Youtube is after music bots on Discord. So we are here to fill the void. Introducing Treble, the next generation of Disco

Aja Khanal 0 Sep 16, 2022
This is RequestTrackerBot and it used for tracking request made by user in a group

This is a Request Tracker Bot repo, It is for those who upload content like movies, anime, etc. It can be used for tracking request of content that your members asked for.

Abhijeet 27 Dec 29, 2022
Huan Xu 1.6k Jan 04, 2023
Discord-disnake - This package allows to use disnake without changing the discord namespace

This package is a shim This module allows to use disnake using discord namespace. This is not an independent library. Installing Python 3.8 or higher

5 Dec 13, 2022