Pre-release
This release is a pre-release and may not be stable for production use.
glutamate
Easy to use Python library for querying and downloading posts from e621.net.
Installation
pip install glutamate
Example
from pathlib import Path
from glutamate.database import E621, E621Data, E621PostsCSV, E621TagsCSV, Query, autoinit_from_directory
from glutamate.dataset import get_captions, write_captions, write_stats
from glutamate.download import download_posts
# Init with qualified file paths
e621_data_directory = Path('./e621-data/')
posts_csv = e621_data_directory / 'posts.csv'
posts = E621PostsCSV(posts_csv)
tags_csv = e621_data_directory / 'tags.csv'
tags = E621TagsCSV(tags_csv)
e621: E621 = E621Data(posts, tags)
# or simple automatic init with directory contains CSVs
e621_data_directory = Path('./e621-data/')
e621 = autoinit_from_directory(e621_data_directory)
query = Query(("kisha", "solo"))
kisha_dataset = e621.select(query)
target_directory = Path().cwd() / 'tmp' / 'kisha_solo'
target_directory.mkdir(parents=True, exist_ok=True)
results = download_posts(posts, target_directory, naming='id')
failed = [result for result in results if not result.ok]
if failed:
print(f"Failed to download {len(failed)} posts")
captions = kisha_dataset.get_captions(
naming='id',
remove_underscores=True,
tags_to_head=('kisha', 'kisha (character)')
)
write_captions(captions, target_directory)
counts_csv = target_directory / 'tags.csv'
counts = kisha_dataset.get_tags_stats()
write_stats(counts, counts_csv)
Metadata
Release files for glutamate 0.0.1a7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| glutamate-0.0.1a7.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| glutamate-0.0.1a7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.8 kB
Release files / glutamate-0.0.1a7.tar.gz
| Download URL | glutamate-0.0.1a7.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50ae4b052d57a8e2b37892e7973f9f18fc04dd7107007b59bfeebe17429bd619
|
|
BLAKE2b-256 checksum How to use checksums |
c509abaf474669421b1f787be0d0f79f49949a2ba54692fd9c658df7a090a518
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.8
|
Release files / glutamate-0.0.1a7-py3-none-any.whl
| Download URL | glutamate-0.0.1a7-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e32695182766d65a500615fba76001d732856d765b001a6dbc8131ea6d9bfeb0
|
|
BLAKE2b-256 checksum How to use checksums |
85f07ae0a6d79e23c1dcece07971eb22431bb8ee64ef7023ab505832907d1cb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.8
|