All my commonly used fuctions
Project description
Asaniczka
The Asaniczka module provides quick functions to get up and running with a scraper.
This documentation is outdated. It will be updated in the next major update
Available Functions:
setup_logger()
: Set up a logger and return the logger instance.save_temp_file()
: Saves the given content to a temporary file in the specified temp folder.format_error()
: Removes newlines from the given error string.get_request()
: Makes a basic HTTP GET request to the given URL.create_dir()
: Creates a new directory.steal_cookies()
: Steals the cookies from a given domain for SSRF
Available Classes:
ProjectSetup
: A class that sets up project folders and provides access to their paths.
Installation
To install Asaniczka, you can use pip:
pip install asaniczka
Note:
Remember to run playwright install
on cmd/terminal after installation to install playwright browsers
Usage
import asaniczka
import asaniczka.db_tools as dbt
import asaniczka.scrape_helper as ash
# Create project folders
project = asaniczka.ProjectSetup("MyProject")
# Set up a logger
logger = asaniczka.setup_logger(project.log_file_path)
# Save content to a temporary file
asaniczka.save_temp_file(content, extension='txt')
# Format an error
formatted_error = asaniczka.format_error(error)
# Make a GET request
response = asaniczka.get_request(url)
# Create a new directory
my_dir = asaniczka.create_dir(os.path.join(project.data_folder,'my_data'))
# check the ratelimit of a website
rate_limit = ash.check_ratelimit('https://amazon.com')
# load a postgres db
project.start_supabase_instance()
# get all the names of tables in the db
table_names = dbt.get_sb_table_names(project, make_list=True)
# backup supabase postgres db
dbt.backup_sb_db(project)
# shutdown database
project.stop_supabase_instance()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asaniczka-2.7.0.tar.gz
(14.7 kB
view hashes)
Built Distribution
asaniczka-2.7.0-py3-none-any.whl
(15.2 kB
view hashes)
Close
Hashes for asaniczka-2.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e94cfd48f630418646a5a0d559cf41e50e376107bfef4637183d84da4e0a7910 |
|
MD5 | 066d87b78a7188bba5ff1fef86512e78 |
|
BLAKE2b-256 | 82c2730984451a7c7153fe4de480df1b79ff0e00fd1ac137823fdba68c4969c6 |