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
The text based version of my App Blocker that I planning on converting to GUI soon.

App-Blocker The text based version of my App Blocker that I planning on converting to GUI soon. Currently I am just uploading the appblocker.py file,

Harsh Raj 0 Sep 13, 2022
A telegram bot that sends a meme a day, from reddit's top meme of the day

MemeBot A telegram bot that sends a meme a day, from reddit's top meme of the day You can use the bot either with an external scheduler (ex: pythonany

Michele Vitulli 1 Dec 13, 2021
Hostapd-mac-monitor - Setup a hostapd AP to conntrol the connections of specific MACs

A brief explanation This script provides way to setup a monitoring service of sp

2 Feb 03, 2022
ANKIT-OS/TG-MUSIC-PLAYER a special repository. Its Is A Telegram Bot To Play To Play Music In Voice Chat

🔥 🎶 TG MUSIC PLAYER 🎶 🔥 The owner would not be responsible for any kind of bans due to the bot. • ⚡ INSTALLING ⚡ • • 🛠️ Lᴀɴɢᴜᴀɢᴇs Aɴᴅ Tᴏᴏʟs 🔰 •

ANKIT KUMAR 1 Dec 27, 2021
Python wrapper for JeyyAPI

Async python wrapper for JeyyAPI

7 Dec 10, 2022
Pure Python 3 MTProto API Telegram client library, for bots too!

Telethon ⭐️ Thanks everyone who has starred the project, it means a lot! Telethon is an asyncio Python 3 MTProto library to interact with Telegram's A

LonamiWebs 7.3k Jan 01, 2023
A project that automatically sends you a Medium article on a topic of your choosing to your email address daily.

Daily Article from Medium ✏️ About A project that automatically sends you a Medium article on a topic of your choosing to your email address daily. No

Orhan Emre Dikicigil 2 Apr 27, 2022
The Most Simple yet Powerful and Advanced Google Colab Notebook for Zip, Unzip, Tar, UnTar, RaR, UnRaR Files in Google Drive

The Most Simple yet Powerful and Advanced Google Colab Notebook for Zip, Unzip, Tar, UnTar, RaR, UnRaR Files in Google Drive

Dr.Caduceus 15 Aug 16, 2022
Asynchronous python aria2 mirror bot Telegram.

aioaria2-mirror-bot A Bot for Telegram made with Python using Pyrogram library. It needs Python 3.9 or newer to run. THIS BOT IS INTENDED TO BE USED O

Adek 85 Jan 03, 2023
❤️ DaisyX 2.0 ❤️ A Powerful, Smart And Simple Group Manager ... Written with AioGram , Pyrogram and Telethon...

❤️ DaisyX 2.0 ❤️ A Powerful, Smart And Simple Group Manager ... Written with AioGram , Pyrogram and Telethon... ⭐️ Thanks to everyone who starred Dais

TeamOfDaisyX 44 Oct 06, 2022
Spacecrypto-bot - SpaceCrypto Bot Auto Clicker

SpaceCrypto Auto Clicker Bot Também fiz um para Luna Rush ( https://github.com/w

Walter Discher Cechinel 5 Feb 22, 2022
A github actions + python code to extract URLs to code repositories to put into standard form, starting with github

A github actions + python code to extract URLs to code repositories to put into standard form, starting with github ---- NOTE: JUS

Justin Gosses 2 Nov 15, 2021
This is new discord nitro generator for discord

Hello! This is new discord nitro generator for discord. If you want use it, To generator i added checker for no seraching generator and checker. This tool maked by .

ItzBolt 1 Jan 16, 2022
This is the repository for HalpyBOT, the Hull Seals IRC Chatbot Assistant.

HalpyBOT 1.4.2 This is the repository for HalpyBOT, the Hull Seals IRC Chatbot Assistant. Description This repository houses all of the files required

The Hull Seals 3 Nov 03, 2022
Modern Desktop Jellyfin Client written in Python and Vue for the UI [WIP]

JellyPlayer Modern Jellyfin Client Installation Install Requirements: Install Python 3 Install dependencies Install node deps for frontend, go to Jell

Prayag Prajapati 57 Dec 12, 2022
This bot will automatically like and follow users that post under a specified hashtag

Instagram-bot This bot will automatically like and follow users that post under a specified hashtag Dependencies Java JDK Selenium Updated version of

Makana Edwards 1 Nov 04, 2021
Bot interpretation of the carbon.now.sh site

📒 Source code of the @PicodeBot 🧸 Developer: @hoosnick Run $ git clone https://github.com/hoosnick/picodebot.git $ pip install -r requirements.txt P

Husniddin Murodov 13 Oct 02, 2022
NewpaperNews-API - Json data of the news with python

NewsAPI API Documentation BASE_URL = "https://saurav.tech/NewsAPI/" top_headline

Aryaman Prakash 2 Sep 23, 2022
A python script to acquire multiple aws ec2 instances in a forensically sound-ish way

acquire_ec2.py The script acquire_ec2.py is used to automatically acquire AWS EC2 instances. The script needs to be run on an EC2 instance in the same

Deutsche Telekom Security GmbH 31 Sep 10, 2022