CraftAPI
CraftAPI is a simple-to-use Python library providing a set of tools for interacting with websites and retrieving various types of information, as well as utility functions for variable manipulation and time formatting.
Installation
Install the package using pip:
pip install craftllc-api
Usage
ReqTools Class
This class provides methods for web scraping and making HTTP requests.
from craftapi import ReqTools, UnknownMethod
req_tools = ReqTools()
# Get page title
title = req_tools.get_page_title("https://www.python.org/")
print(f"Page Title: {title}")
# Get all links on a page
links = req_tools.get_all_links("https://www.python.org/")
print("All Links:")
for link in links[:5]: # Print first 5 links
print(link)
# Check HTTP status code
status_code = req_tools.check_http_status("https://www.python.org/")
print(f"HTTP Status Code: {status_code}")
# Extract all paragraphs
paragraphs = req_tools.extract_paragraphs("https://www.python.org/")
print("First Paragraph:")
if paragraphs:
print(paragraphs[0])
# Get meta tags
meta_tags = req_tools.get_meta_tags("https://www.python.org/")
print("Meta Tags:")
for name, content in meta_tags.items():
print(f" {name}: {content}")
# Check SSL certificate (basic check)
ssl_status = req_tools.check_ssl_certificate("https://www.google.com/")
print(f"SSL Status: {ssl_status}")
# Save HTML content to a file
save_status = req_tools.save_html_to_file("https://www.python.org/", "python_org.html")
print(save_status)
# Extract list items
list_items = req_tools.extract_list_items("https://www.python.org/")
print("First List Item:")
if list_items:
print(list_items[0])
# Get the first H1 tag
h1_tag = req_tools.get_first_h1("https://www.python.org/")
print(f"First H1 Tag: {h1_tag}")
# Get all script URLs
scripts = req_tools.get_all_scripts("https://www.python.org/")
print("First Script URL:")
if scripts:
print(scripts[0])
# Extract form data
form_data = req_tools.extract_form_data("https://www.w3schools.com/html/html_forms.asp")
print("Form Data (first form):")
if form_data:
print(form_data[0])
# Get CSS links
css_links = req_tools.get_css_links("https://www.python.org/")
print("First CSS Link:")
if css_links:
print(css_links[0])
# Find all image URLs
image_urls = req_tools.find_all_images_url("https://www.python.org/")
print("First Image URL:")
if image_urls:
print(image_urls[0])
# WHOIS lookup
whois_info = req_tools.whois("8.8.8.8")
print("WHOIS Info for 8.8.8.8:")
for key, value in whois_info.items():
print(f" {key}: {value}")
# Example of UnknownMethod exception
try:
req_tools.find_all_images_url("https://example.com", method="INVALID")
except UnknownMethod as e:
print(f"Caught expected exception: {e}")
Wordle Class
This class provides methods related to New York Times games, specifically Wordle.
from craftapi import Wordle
wordle_game = Wordle()
# Get today's Wordle answer
wordle_answer = wordle_game.answer()
print(f"Today's Wordle Answer: {wordle_answer}")
Lessgames Class
This class provides methods related to Lessgames games, specifically Wordless.
from craftapi import Lessgames
wordless_game = Lessgames.Wordless()
# Get today's answer for a 5-letter challenge
print(wordless_game.answer(length=5))
# Get today's answer for a 6-letter challenge
print(wordless_game.answer(length=6))
# Get today's answers for every supported length (3-8 letters)
print(wordless_game.answer())
VarTools Class
This class provides utility methods for variable inspection and time formatting.
from craftapi import VarTools
my_vars = {"name": "CraftAPI", "version": 0.1, "is_active": True}
var_tools = VarTools(my_vars)
# Get variable value
name_value = var_tools.get_var_value("name")
print(f"Value of 'name': {name_value}")
# Clean variable type
name_type = var_tools.clean_type("name")
version_type = var_tools.clean_type("version")
print(f"Type of 'name': {name_type}")
print(f"Type of 'version': {version_type}")
# Format time in seconds
formatted_time_seconds = var_tools.format_time(30)
formatted_time_minutes = var_tools.format_time(150)
formatted_time_hours = var_tools.format_time(7200)
formatted_time_days = var_tools.format_time(90000)
print(f"30 seconds: {formatted_time_seconds}")
print(f"150 seconds: {formatted_time_minutes}")
print(f"7200 seconds: {formatted_time_hours}")
print(f"90000 seconds: {formatted_time_days}")
License
This project is licensed under the MIT License.
Metadata
Release files for craftllc-api 26.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| craftllc_api-26.1.1.tar.gz | 7.9 kB | Without provenance | Details for craftllc_api-26.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| craftllc_api-26.1.1-py3-none-any.whl | Python 3 | none | any | Details for craftllc_api-26.1.1-py3-none-any.whl |
Total release size: 16.3 kB
Release files / craftllc_api-26.1.1.tar.gz
| Download URL | craftllc_api-26.1.1.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22d959c9192abd1cfc149666e125c2de58bdc3f73a0ef70ad381114111349572
|
|
BLAKE2b-256 checksum How to use checksums |
c3535a65b226aff4ccdc233398209dbf63322dbecea5c9fc016cc8f6baa9d6ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / craftllc_api-26.1.1-py3-none-any.whl
| Download URL | craftllc_api-26.1.1-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35d07a503c7b8c8475023c50b343b0cf97ee0c132d0dfc92479a36659eb38512
|
|
BLAKE2b-256 checksum How to use checksums |
56bc6ebcb4c3cd6b95ce2fef158fc34c8dc5d9da35ca4a82c12e525fab3a6b0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for craftllc-api 26.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.