Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

burgos

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

burgos

A bundle of useful packages for managing login sessions and database

  • 2.2.1
  • PyPI
  • Socket score

Maintainers
1

Session

Usage:

from burgos.session import Session
session = Session(database_auth, login_table)

database_auth: json/dict

{
    "host": "host ip address or domain",
    "database": "database name",
    "user": "username",
    "password": "user password"
}

login_table: string

"table_name_which_contains_login_data"

Built-in methods

database.reconnectDatabase()
  • reconnects to the database
getConnection(ip)
  • ip = string containing an ip address
  • returns the connection matching the selected ip address
  • if there is no connection with that ip, returns None
login(user, password, ip)
  • user = string containing the username, email or cpf as login method
  • password = string containg the password
  • ip = string containing an ip address
  • if "user" is number only, it will be checked as cpf
  • if "user" has an "@", it will be checked as an email
  • if "user" is neither, it will be checked as an username
  • if there is a row in database.login_table that matches with this user and password, a Connection will be instanciated and the user id will be returned

Mysql

Usage:

from burgos.mysql_handler import Mysql
database = Mysql(login_table)

login_table: string

"table_name_which_contains_login_data"

Built-in methods

connect(auth:dict)
  • auth = dictionary containing authentication data (same as session's database_auth)
  • connects to the database and must be called before any other method (session already calls this in it's constructor)
disconnect()
  • disconnects from the database
run(sql)
  • sql = string containing SQL code
  • sql code will be executed and commited into the database
  • if sql first word, lowered, is equal to "select", this method will return a list containing the selected rows
fetchTable(table, rows = 0, where = [], reversed = None, ordered = None)
  • table = string containing the table name which should be selected data from
  • rows = int number that means the number of rows that should be selected. Optional (default: all rows)
  • where = list containing strings which are the column and value. Ex.: where = ["username", "nandobfer"]. Optional.
  • reversed = boolean indicating if the where query should be reversed or not. Optional.
  • ordered = string containing the "ORDER BY" information. Ex. ordered = "id" / ordered = "datetime DESC"
  • Returns a list containing another list for each row fetched. Returns an empty list if there was none.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc