semvec/pypi-packages huggingface dataset:
gorgonzola 0.2.0
AWS Boto3 helper functions for multi-account control

# GORGONZOLA

Python helper functions for AWS Boto3.

## Description

Gorgonzola is a set of helper functions to simplify AWS multi-account control.

Wrapping around AWS Boto3, Gorgonzola provides simple execution of commonly used API operations.


## Installation

```python
import gorgonzola
```

## Documentation

For further information, please see the [ documentation ](https://github.com/shibboleth66/gorgonzola/blob/master/docs/Contents.md)
login.py 0.0.1
A simple Flask library to make login management easier.
Requires Python: >=3.6

# Login.py

Login.py is a simple library for Flask that makes you able to handle login easily without getting plenty of useless lines of code.

## Installation

```bash
pip3 install login.py
```

## Usage

You can find the full demo of login.py [here](./login-ex.py). You can also find the source code of login.py [here](./login.py).

### initLogin(app, db)

This function is used to create the `User` class. Having this function is necessary for the rest of the program. Without this, the Users cannot get stored into the database.

```python
from flask import Flask, request
from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
from login import *

# Create the "app" and "db" variables
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
app.config['SECRET_KEY'] = 'aghzi vnguierhtrutizo hard to guess indeeed'
db = SQLAlchemy(app)

# Create the User class and add it to the database
User = initLogin(app, db)
db.create_all()
```

### createUser(username, password, db, User)

This function is used to sign up a new user into the database. This is an example of usage:

```python
@app.route('/register/post', methods=['POST'])
def register():
    try:
        createUser(request.form['username'], request.form['password'], db, User)
        return "New user created you are now logged in as " + current_user.username
    except: 
    		return "This username is already taken"
```

### loginUser(username, password, User)

This function is used to login a user, that means that the user must already be in the database.

```python
@app.route('/login/post', methods=['POST'])
def login():
    try:
        loginUser(request.form['username'], request.form['password'], User)
        return "You are now logged in as " + current_user.username
    except: 
    		return "Invalid username or password"
```


### logout_user()

This is not a function from login.py, but a function from flask_login. The usage of this function is very simple:

```python
@app.route('/logout')
def logout(): 
    logout_user()
    return "You are now logged out."
```

### \@login_required

When you add this line under a url route, it locks the page to the logged in users. The users that are not logged will have a `Unauthorized` error showing up.

```python

@app.route('/locked')
@login_required # Using login_required to make a page private
def locked(): 
	return "Hello " + current_user.username + " welcome to your private page."
```
local-reload 1.2.4
Django app for automatically identifying and reloading stale web pages
Requires Python: >=3.6

# local_reload

Provides a means of identifying and automatically reloading "stale" pages. 

Keeps a "last update time" in localStorage, and updates it whenever the user "updates data". Any time the user "returns" to a page (via browser history, or switches tabs/windows), that page will automatically reload if it is stale (if it was rendered before the last update time).

Intended for use on CRUD heavy sites, especially when you use history.back() or use multiple tabs/windows as part of the normal workflow.

## Limitations

### Update Time is Per-Browser

If data is updated in one browser, it will not reload pages in another browser. This is designed for a single user updating and viewing data in a single browser. We use `window.localStorage` to store the update time, so our scope is the same as that of localStorage (hence the name "local_reload").

### Update Time is Site-Wide

A single, site-wide "update time" is maintained. A change in one piece of data will invalidate all previously rendered pages, even if they do not display that data.

### Update Detection

We automatically reset the update time when any form is POSTed. To be more precise - we reset the update time on every form submit event, as long as the form's method is not GET.

This works well if you use actual form submissions (even if handled via javascript) as the event which triggers data updates. If you update data without the user submitting a form, then you must manually call `window.local_reload_invalidate()`.

### No Background Reload

Pages will not be reloaded in background tabs/windows. They will only be reloaded when the user returns focus to them. This is actually by design. Previous attempts to reload background windows/tabs resulted in undesirable behaviour in many situations.

## Installation

- `pip install local_reload`
- add 'local_reload' to `INSTALLED_APPS`
- `{% include "local_reload/local_reload_support.html" %}` in the `head`<sup>\*</sup> of any page that displays or updates data

<sup>\*</sup> This should be added near the top of your `head`, so it can run as early as possible.

## `window.disable_local_reload`

Set this to true if you want to temporarily/conditionally disable local reload on the given window.

## NavTricks

We include a copy of NavTricks.js in our static files. This script pairs perfectly with local_reload.