pyawful
Spend $10 to interact with a dead forum from Python.
[!CAUTION] Using this library without being funny may lead to your account being permanently banned.
Let's be honest, here: That's probably a net positive.
Installation
This package is available via PyPi as pyawful
and can be installed via your package manager of choice.
Usage
import os
from pyawful import AuthenticatedAwfulSession
USERNAME = os.environ["SA_USERNAME"]
PASSWORD = os.environ["SA_PASSWORD"]
with AuthenticatedAwfulSession(USERNAME, PASSWORD) as client:
response = client.get_forum_threads(273)
for thread in response.threads:
print(thread.title)
Caching Authentication Session
[!WARNING] Ignore this advice if you want to pay $10 again
Limit the number of sessions you create - if you're making lots of requests or otherwise doing something regularly you should persist the session cookies and restore them.
from datetime import datetime
import json
import os
from pyawful import AuthenticatedAwfulSession, AwfulCookies
USERNAME = os.environ["SA_USERNAME"]
PASSWORD = os.environ["SA_PASSWORD"]
session = AuthenticatedAwfulSession(USERNAME, PASSWORD)
try:
with open("./session.json", "r") as session_file:
cached_session = json.load(session_file)
cookies = AwfulCookies(**cached_session["cookies"])
expiration = datetime.fromtimestamp(cached_session["expiration"])
session.resume_session(cookies, expiration)
except Exception:
pass
with session as client:
cookies = session.get_cookies()
expiration = session.get_expiration().timestamp()
with open("./session.json", "w") as session_file:
json.dump(
{ "cookies": cookies, "expiration": expiration },
session_file
)
License
Licensed under the MIT License.
Metadata
Release files for pyawful 0.5.0
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 |
|---|---|---|---|---|
| pyawful-0.5.0.tar.gz | 73.9 kB | Without provenance | Details for pyawful-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyawful-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for pyawful-0.5.0-py3-none-any.whl |
Total release size: 88.8 kB
Release files / pyawful-0.5.0.tar.gz
| Download URL | pyawful-0.5.0.tar.gz |
|---|---|
| Size | 73.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0866dfc47afb255b31cadd44b380310d53d06062e7dde86f27b52a36d3a94e29
|
|
BLAKE2b-256 checksum How to use checksums |
ae0bf5d201d9d4de11261b62fc561cd0bcbde1290fc1cc1d9701f936e659e404
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.9
|
Release files / pyawful-0.5.0-py3-none-any.whl
| Download URL | pyawful-0.5.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5570a1f508d2c9f7d0d46373486c46d36b83508d9883f781dd8b71295fa2826c
|
|
BLAKE2b-256 checksum How to use checksums |
f0ecd528a5a12ed9160221932bab50083f12ba720ddae02bedca450bb78a82a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.9
|
Security for pyawful 0.5.0
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.