Python SDK and CLI for PostLocker API - Save, search, organize content into groups, manage tags and user accounts.
Project description
PostLocker CLI
PostLocker CLI is a command-line interface tool designed to help you manage your saved content efficiently. With PostLocker, you can save, delete, search, and organize your content into groups, manage tags, and handle user accounts.
Table of Contents
Installation
From Source
-
Clone the repository:
git clone https://github.com/yourusername/postlocker-cli.git cd postlocker-cli
-
Install the dependencies:
pip install -r requirements.txt
-
Install the package (add
[cli]for the CLI):pip install .[cli]
From PyPI
- Library only:
pip install postlocker - Library + CLI:
pip install postlocker[cli]
Usage
Once installed, you can use the postlocker command to interact with the CLI. Use postlocker --help to see the available commands and options.
Commands
Common options
--host : Pick the base PostLocker host (defaults to production https://api.postlocker.app)
--raw : Print the results as raw JSON from the API
--summary : Show AI-generated summaries for content (available in list and search commands)
--limit: Limit the amount of results listed, list the first X items. (use with --offset to create paging)
--offset: start the listing after skipping the first X items (use with --limit to create paging)
Tokens
The CLI tool will manage your tokens for you, if there are no tokens, all commands will securely ask you for your username and password before executing and store a token for you while it's still valid. You can cache multipe tokens for different hosts.
Tokens are safely encrypted and saved hidden in your home folder ~/.postlocker/tokens.json
tokens clear: Clear all cached tokens.tokens list: List all cached tokens.
Content Management
save: Save content to PostLocker.- Options:
--title,--description,--tags,--host
- Options:
delete: Delete content from PostLocker by ID.- Options:
--host
- Options:
list: List all saved content.- Options:
--host,--raw,--summary,--pipe,--limit,--offset,--since,--content-type - Note: The
--sinceoption takes an ISO formatted datetime (timezone aware or UTC asumed if naive) and outputs all the saves and groups that have been updated since that date and all deleted objects (saves and groups). If it's combined with--pipeor--rawit will only output the updated saves. - The
--content-typeoption filters saves by their content type
- Options:
get: Get content by ID.- Options:
--host
- Options:
search: Search saved content.- Options:
--limit,--semantic,--distance,--host,--raw,--summary,--pipe,--content-type - The
--content-typeoption filters search results by their content type
- Options:
export: Export saved content to JSON or CSV format.- Options:
--output,--format,--host,--pretty,--limit,--offset
- Options:
import: Import content from a CSV file.- Options:
--host,--delay,--limit,--offset,--pipe
- Options:
clear: Delete ALL saves and groups from your account (WARNING: DESTRUCTIVE ACTION).- Options:
--host
- Options:
Groups
groups list: List all content groups.- Options:
--host,--raw
- Options:
groups get ID [SAVE_IDS]: Get content from a specific group or modify group contents.- Options:
--add, -a: Add the specified save IDs to this group--delete, -d: Remove the specified save IDs from this group--host, -h: PostLocker host URL--raw: Display full JSON data--pipe: Output only save IDs for piping--limit, -l: Limit the number of saves to display--offset, -s: Number of saves to skip--summary: Show AI summary for each save
- Note:
--addand--deletecannot be used together - Examples:
- View group contents:
postlocker groups get "550e8400-e29b-41d4-a716-446655440000" - Add saves to group:
postlocker groups get "550e8400-e29b-41d4-a716-446655444020" "123" "456" --add - Remove from group:
postlocker groups get "8a7b3c4d-5e6f-7g8h-9i0j-123456789abc" "123" --delete - Pipe search results to group:
postlocker search "topic" --pipe | postlocker groups get "9b8a7c6d-5e4f-3g2h-1i0j-abcdef123456" --add
- View group contents:
- Options:
groups create: Create a new group.- Options:
--host
- Options:
groups rm: Delete a group.- Options:
--host
- Options:
Users
users me: Get current user information.- Options:
--host,--raw
- Options:
users list: List all users (admin only).- Options:
--host: PostLocker host URL--raw: Display full JSON data--limit, -l: Limit the number of users to display--offset, -o: Number of users to skip--include-length: Include the number of saves for each user in the output
- Options:
users create: Create a new user or batch create users from piped input.- Options:
--host: PostLocker host URL--pipe: Read email addresses from standard input--yes, -y: Automatically generate passwords without prompting--delay: Delay in seconds between creating users in batch (default: 0.5)
- Examples:
- Create single user (will prompt for password): ```bash postlocker users create ```
- Create multiple users from a file with auto-generated passwords: ```bash cat accounts.txt | postlocker users create --pipe -y ```
- Create users with custom delay between creations: ```bash cat accounts.txt | postlocker users create --pipe -y --delay 1.0 ```
- Note: When not using
--yes, passwords are securely prompted and require confirmation (leave empty to auto generate). With--yes, passwords are automatically generated and displayed.
- Options:
users set-admin: Set user as admin.- Options:
--host
- Options:
users set-active: Set user as active.- Options:
--host
- Options:
users reset-password: Reset user password.- Options:
--host - Note: Passwords are securely prompted and require confirmation.
- Options:
Tags
tags list: List all tags.- Options:
--host,--raw
- Options:
tags get: Get saves by tag.- Options:
--host,--raw
- Options:
tags add: Add a tag to a save.- Options:
--host
- Options:
tags remove: Remove a tag from a save.- Options:
--host
- Options:
AI Features
ai analyse: Re-analyze a specific save or piped saves to update AI metadata.- Options:
--host,--raw,--summary
- Options:
ai all: Re-analyze all saves to update AI metadata.- Options:
--delay,--limit,--offset,--host
- Options:
Command Piping
PostLocker CLI supports piping between commands, allowing you to chain operations together. Commands that list or search content can pipe their results to commands that operate on individual saves.
Examples:
-
Delete all posts related to "Football":
postlocker search "Football" --pipe | postlocker delete
-
Analyze the first 10 saves:
postlocker list --limit 10 --pipe | postlocker ai analyse
-
Add all Unity-related posts to a group (by id):
postlocker search "Unity" --pipe | postlocker groups get -a "1218471-1248917-12410897f34"
-
Export specific search results:
postlocker search "important" --pipe | postlocker export -o important.json
-
Import saves and add them to the "Newly imported" group (by id):
postlocker import data.csv --pipe | postlocker groups get "1209145-158-13258-91851f" -a
Commands that support --pipe output:
list: List all savessearch: Search for savesgroups get: List saves in a groupimport: After importing saves
Commands that accept piped input:
delete: Delete savesai analyse: Analyze savesexport: Export specific savesgroups get --add: Add saves to a group
Admin Privileges
Certain commands require admin privileges, such as managing users (users list, users set-admin, users set-active, users reset-password). Ensure you have the necessary permissions to execute these commands.
For more detailed information on each command, use the --help option with the command, e.g., postlocker groups get --help.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file postlocker-1.0.0.tar.gz.
File metadata
- Download URL: postlocker-1.0.0.tar.gz
- Upload date:
- Size: 19.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57cb61f698ba8fc7e09342612ed2936b0483d61623348f007aea8de4032f686d
|
|
| MD5 |
b6fdbce1613ef6734bb55d4d2746e70d
|
|
| BLAKE2b-256 |
d71958e0f306945794bc08eff5ee4ef26e1b4f69c91bcfcde8b9b136b876520f
|
Provenance
The following attestation bundles were made for postlocker-1.0.0.tar.gz:
Publisher:
workflow.yml on SinewaysTechnology/PostLockerCLI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
postlocker-1.0.0.tar.gz -
Subject digest:
57cb61f698ba8fc7e09342612ed2936b0483d61623348f007aea8de4032f686d - Sigstore transparency entry: 992589736
- Sigstore integration time:
-
Permalink:
SinewaysTechnology/PostLockerCLI@37be4bc7f212735059ff71737dcc8de92c5e7bd0 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/SinewaysTechnology
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@37be4bc7f212735059ff71737dcc8de92c5e7bd0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file postlocker-1.0.0-py3-none-any.whl.
File metadata
- Download URL: postlocker-1.0.0-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff74a683d1790194cb4ab2dc37c15af18bb9a05099fb84bf95a0fad31fbae213
|
|
| MD5 |
58b4cc34648cfe9fbe7c77bee7824e88
|
|
| BLAKE2b-256 |
6544dfb2a2e8f82d89eb80ea3ec56c1ed5cebf34cfd0cf85e0f468d094aaf490
|
Provenance
The following attestation bundles were made for postlocker-1.0.0-py3-none-any.whl:
Publisher:
workflow.yml on SinewaysTechnology/PostLockerCLI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
postlocker-1.0.0-py3-none-any.whl -
Subject digest:
ff74a683d1790194cb4ab2dc37c15af18bb9a05099fb84bf95a0fad31fbae213 - Sigstore transparency entry: 992589737
- Sigstore integration time:
-
Permalink:
SinewaysTechnology/PostLockerCLI@37be4bc7f212735059ff71737dcc8de92c5e7bd0 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/SinewaysTechnology
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@37be4bc7f212735059ff71737dcc8de92c5e7bd0 -
Trigger Event:
push
-
Statement type: