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)
You might also like...
Use PyTgCalls easier than before.

PyTgCalls wrapper Making it easier for you to use pytgcalls. Features No need to care about audio convertion. Play directly from URLs, YouTube and loc

AHA is an incident management & communication framework to provide real-time alert customers when there are active AWS event(s). For customers with AWS Organizations, customers can get aggregated active account level events of all the accounts in the Organization. Customers not using AWS Organizations still benefit alerting at the account level.
This is a tutorial on how to make a Discord Bot using the discord.py library

HowToMakeADiscordBot This Github repository is here to help you code a Discord Bot using the discord.py library! 1 - Setup: Download the code inside t

Popcorn-time-api - Python API for interacting with the Popcorn Time Servers

Popcorn Time API 📝 CONTRIBUTIONS Before doing any contribution read CONTRIBUTIN

An Inline Telegram YouTube Downloader bot with custom, permanent thumbnail support and cancel upload facility. Make your fork now.

Inline-Tube-Mate (YouTube Downloader) An Inline Telegram bot that can download YouTube videos with permanent thumbnail support Bot need to be in Inlin

Archive tweets and make them searchable
Archive tweets and make them searchable

Tweeter Archive and search your tweets and liked tweets using AWS Lambda, DynamoDB and Elasticsearch. Note: this project is primarily being used a tes

a discord libary that use to make discord bot with low efficiency and bad performance because I don't know how to manage the project

Aircord 🛩️ a discord libary that use to make discord bot with low efficiency and bad performance because I don't know how to manage the project Examp

Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python

Autodrive Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python. It is especially designed

iso6.9 is a Discord bot written in Python and is used to make your Discord experience better

iso6.9-2.6stable (debloated) iso.bot is originally made by notsniped#4573. This is a remix of iso.bot by αrchιshα#5518. iso6.9 is a Discord bot writte

Owner
Tygzy
Intermediate knowledge in Python, Java, JavaScript, SQLite3, and knowledge in markup.
Tygzy
domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time.

domhttpx is a google search engine dorker with HTTP toolkit built with python, can make it easier for you to find many URLs/IPs at once with fast time

Naufal Ardhani 59 Dec 4, 2022
A smooth and powerful Telegram Userbot made to make Telegram easier.

| Xᴇɴᴏ Bᴏᴛ Is One Of The Fastest & Smoothest Bot On Telegram Based on Telethon|

SimpleBoy 1 Dec 1, 2021
The purpose of this bot is to take soundcloud track requests, that are posted in the stream-requests channel, and add them to a playlist, to make the process of scrolling through the requests easier for Root

Discord Song Collector Dont know if anyone is actually going to read this, but the purpose of this bot is to check every message in the stream-request

null 2 Mar 1, 2022
Just a python library to make reddit post caching easier

Reddist Just a python library to make reddit post caching easier. Caching Options In Memory Caching Redis Caching Pickle Caching Usage Installation: D

Samrid Pandit 3 Jan 16, 2022
A python library created to make life easier for Telegram API Developers.

opentele A python library created to make life easier for Telegram API Developers. Read the documentation Features Convert Telegram Desktop tdata sess

null 103 Jan 2, 2023
An almost dependency-less, synchronous Discord gateway library meant for my personal use

An almost dependency-less, synchronous Discord gateway library meant for my personal use.

h0nda 4 Feb 5, 2022
A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier

A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier

Amazon Web Services - Labs 1.9k Jan 7, 2023
Process your transactions from etherscan (and other forks) into excel file for easier manipulation.

DEGEN TRACKER Read first This is my first Python open source project and it is very likely full of bad practices and security issues. You should not u

null 1 Oct 13, 2022
Framework for creating and running trading strategies. Blatantly stolen copy of qtpylib to make it work for Indian markets.

>_• Kinetick Trade Bot Kinetick is a framework for creating and running trading strategies without worrying about integration with broker and data str

Vinay 41 Dec 31, 2022
:electric_plug: Generating short urls with python has never been easier

pyshorteners A simple URL shortening API wrapper Python library. Installing pip install pyshorteners Documentation https://pyshorteners.readthedocs.i

Ellison 351 Jan 3, 2023