postlocker 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- postlocker-1.0.0/PKG-INFO +254 -0
- postlocker-1.0.0/README.md +225 -0
- postlocker-1.0.0/postlocker/__init__.py +20 -0
- postlocker-1.0.0/postlocker/cli/__init__.py +1 -0
- postlocker-1.0.0/postlocker/cli/commands.py +1352 -0
- postlocker-1.0.0/postlocker/exporters.py +48 -0
- postlocker-1.0.0/postlocker/postlocker.py +419 -0
- postlocker-1.0.0/postlocker/token_manager.py +137 -0
- postlocker-1.0.0/postlocker.egg-info/PKG-INFO +254 -0
- postlocker-1.0.0/postlocker.egg-info/SOURCES.txt +14 -0
- postlocker-1.0.0/postlocker.egg-info/dependency_links.txt +1 -0
- postlocker-1.0.0/postlocker.egg-info/entry_points.txt +2 -0
- postlocker-1.0.0/postlocker.egg-info/requires.txt +7 -0
- postlocker-1.0.0/postlocker.egg-info/top_level.txt +1 -0
- postlocker-1.0.0/pyproject.toml +51 -0
- postlocker-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: postlocker
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python SDK and CLI for PostLocker API - Save, search, organize content into groups, manage tags and user accounts.
|
|
5
|
+
Author-email: "David Jonas @ Sineways Technology" <info@sineways.tech>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/SinewaysTechnology/PostLockerCLI
|
|
8
|
+
Project-URL: Issues, https://github.com/SinewaysTechnology/PostLockerCLI/issues
|
|
9
|
+
Keywords: postlocker,cli,content,saved,api
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: requests
|
|
24
|
+
Requires-Dist: pyjwt>=2.9.0
|
|
25
|
+
Requires-Dist: passlib>=1.7.4
|
|
26
|
+
Requires-Dist: cryptography>=41.0.0
|
|
27
|
+
Provides-Extra: cli
|
|
28
|
+
Requires-Dist: click>=8.0.0; extra == "cli"
|
|
29
|
+
|
|
30
|
+
# PostLocker CLI
|
|
31
|
+
|
|
32
|
+
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.
|
|
33
|
+
|
|
34
|
+
## Table of Contents
|
|
35
|
+
|
|
36
|
+
- [PostLocker CLI](#postlocker-cli)
|
|
37
|
+
- [Table of Contents](#table-of-contents)
|
|
38
|
+
- [Installation](#installation)
|
|
39
|
+
- [From Source](#from-source)
|
|
40
|
+
- [From PyPI](#from-pypi)
|
|
41
|
+
- [Usage](#usage)
|
|
42
|
+
- [Commands](#commands)
|
|
43
|
+
- [Common options](#common-options)
|
|
44
|
+
- [Tokens](#tokens)
|
|
45
|
+
- [Content Management](#content-management)
|
|
46
|
+
- [Groups](#groups)
|
|
47
|
+
- [Users](#users)
|
|
48
|
+
- [Tags](#tags)
|
|
49
|
+
- [AI Features](#ai-features)
|
|
50
|
+
- [Command Piping](#command-piping)
|
|
51
|
+
- [Admin Privileges](#admin-privileges)
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
### From Source
|
|
56
|
+
|
|
57
|
+
1. Clone the repository:
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/yourusername/postlocker-cli.git
|
|
60
|
+
cd postlocker-cli
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
2. Install the dependencies:
|
|
64
|
+
```bash
|
|
65
|
+
pip install -r requirements.txt
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
3. Install the package (add `[cli]` for the CLI):
|
|
69
|
+
```bash
|
|
70
|
+
pip install .[cli]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### From PyPI
|
|
74
|
+
|
|
75
|
+
- **Library only:** `pip install postlocker`
|
|
76
|
+
- **Library + CLI:** `pip install postlocker[cli]`
|
|
77
|
+
|
|
78
|
+
## Usage
|
|
79
|
+
|
|
80
|
+
Once installed, you can use the `postlocker` command to interact with the CLI. Use `postlocker --help` to see the available commands and options.
|
|
81
|
+
|
|
82
|
+
## Commands
|
|
83
|
+
|
|
84
|
+
### Common options
|
|
85
|
+
`--host` : Pick the base PostLocker host (defaults to production `https://api.postlocker.app`)
|
|
86
|
+
|
|
87
|
+
`--raw` : Print the results as raw JSON from the API
|
|
88
|
+
|
|
89
|
+
`--summary` : Show AI-generated summaries for content (available in list and search commands)
|
|
90
|
+
|
|
91
|
+
`--limit`: Limit the amount of results listed, list the first X items. (use with `--offset` to create paging)
|
|
92
|
+
|
|
93
|
+
`--offset`: start the listing after skipping the first X items (use with `--limit` to create paging)
|
|
94
|
+
|
|
95
|
+
### Tokens
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
|
|
99
|
+
Tokens are safely encrypted and saved hidden in your home folder `~/.postlocker/tokens.json`
|
|
100
|
+
|
|
101
|
+
- **`tokens clear`**: Clear all cached tokens.
|
|
102
|
+
- **`tokens list`**: List all cached tokens.
|
|
103
|
+
|
|
104
|
+
### Content Management
|
|
105
|
+
|
|
106
|
+
- **`save`**: Save content to PostLocker.
|
|
107
|
+
- Options: `--title`, `--description`, `--tags`, `--host`
|
|
108
|
+
- **`delete`**: Delete content from PostLocker by ID.
|
|
109
|
+
- Options: `--host`
|
|
110
|
+
- **`list`**: List all saved content.
|
|
111
|
+
- Options: `--host`, `--raw`, `--summary`, `--pipe`, `--limit`, `--offset`, `--since`, `--content-type`
|
|
112
|
+
- Note: The `--since` option 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 `--pipe` or `--raw` it will only output the updated saves.
|
|
113
|
+
- The `--content-type` option filters saves by their content type
|
|
114
|
+
- **`get`**: Get content by ID.
|
|
115
|
+
- Options: `--host`
|
|
116
|
+
- **`search`**: Search saved content.
|
|
117
|
+
- Options: `--limit`, `--semantic`, `--distance`, `--host`, `--raw`, `--summary`, `--pipe`, `--content-type`
|
|
118
|
+
- The `--content-type` option filters search results by their content type
|
|
119
|
+
- **`export`**: Export saved content to JSON or CSV format.
|
|
120
|
+
- Options: `--output`, `--format`, `--host`, `--pretty`, `--limit`, `--offset`
|
|
121
|
+
- **`import`**: Import content from a CSV file.
|
|
122
|
+
- Options: `--host`, `--delay`, `--limit`, `--offset`, `--pipe`
|
|
123
|
+
- **`clear`**: Delete ALL saves and groups from your account (WARNING: DESTRUCTIVE ACTION).
|
|
124
|
+
- Options: `--host`
|
|
125
|
+
|
|
126
|
+
### Groups
|
|
127
|
+
|
|
128
|
+
- **`groups list`**: List all content groups.
|
|
129
|
+
- Options: `--host`, `--raw`
|
|
130
|
+
- **`groups get ID [SAVE_IDS]`**: Get content from a specific group or modify group contents.
|
|
131
|
+
- Options:
|
|
132
|
+
- `--add, -a`: Add the specified save IDs to this group
|
|
133
|
+
- `--delete, -d`: Remove the specified save IDs from this group
|
|
134
|
+
- `--host, -h`: PostLocker host URL
|
|
135
|
+
- `--raw`: Display full JSON data
|
|
136
|
+
- `--pipe`: Output only save IDs for piping
|
|
137
|
+
- `--limit, -l`: Limit the number of saves to display
|
|
138
|
+
- `--offset, -s`: Number of saves to skip
|
|
139
|
+
- `--summary`: Show AI summary for each save
|
|
140
|
+
- Note: `--add` and `--delete` cannot be used together
|
|
141
|
+
- Examples:
|
|
142
|
+
- View group contents: `postlocker groups get "550e8400-e29b-41d4-a716-446655440000"`
|
|
143
|
+
- Add saves to group: `postlocker groups get "550e8400-e29b-41d4-a716-446655444020" "123" "456" --add`
|
|
144
|
+
- Remove from group: `postlocker groups get "8a7b3c4d-5e6f-7g8h-9i0j-123456789abc" "123" --delete`
|
|
145
|
+
- Pipe search results to group: `postlocker search "topic" --pipe | postlocker groups get "9b8a7c6d-5e4f-3g2h-1i0j-abcdef123456" --add`
|
|
146
|
+
- **`groups create`**: Create a new group.
|
|
147
|
+
- Options: `--host`
|
|
148
|
+
- **`groups rm`**: Delete a group.
|
|
149
|
+
- Options: `--host`
|
|
150
|
+
|
|
151
|
+
### Users
|
|
152
|
+
|
|
153
|
+
- **`users me`**: Get current user information.
|
|
154
|
+
- Options: `--host`, `--raw`
|
|
155
|
+
- **`users list`**: List all users (admin only).
|
|
156
|
+
- Options:
|
|
157
|
+
- `--host`: PostLocker host URL
|
|
158
|
+
- `--raw`: Display full JSON data
|
|
159
|
+
- `--limit, -l`: Limit the number of users to display
|
|
160
|
+
- `--offset, -o`: Number of users to skip
|
|
161
|
+
- `--include-length`: Include the number of saves for each user in the output
|
|
162
|
+
- **`users create`**: Create a new user or batch create users from piped input.
|
|
163
|
+
- Options:
|
|
164
|
+
- `--host`: PostLocker host URL
|
|
165
|
+
- `--pipe`: Read email addresses from standard input
|
|
166
|
+
- `--yes, -y`: Automatically generate passwords without prompting
|
|
167
|
+
- `--delay`: Delay in seconds between creating users in batch (default: 0.5)
|
|
168
|
+
- Examples:
|
|
169
|
+
- Create single user (will prompt for password):
|
|
170
|
+
\```bash
|
|
171
|
+
postlocker users create
|
|
172
|
+
\```
|
|
173
|
+
- Create multiple users from a file with auto-generated passwords:
|
|
174
|
+
\```bash
|
|
175
|
+
cat accounts.txt | postlocker users create --pipe -y
|
|
176
|
+
\```
|
|
177
|
+
- Create users with custom delay between creations:
|
|
178
|
+
\```bash
|
|
179
|
+
cat accounts.txt | postlocker users create --pipe -y --delay 1.0
|
|
180
|
+
\```
|
|
181
|
+
- 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.
|
|
182
|
+
- **`users set-admin`**: Set user as admin.
|
|
183
|
+
- Options: `--host`
|
|
184
|
+
- **`users set-active`**: Set user as active.
|
|
185
|
+
- Options: `--host`
|
|
186
|
+
- **`users reset-password`**: Reset user password.
|
|
187
|
+
- Options: `--host`
|
|
188
|
+
- Note: Passwords are securely prompted and require confirmation.
|
|
189
|
+
|
|
190
|
+
### Tags
|
|
191
|
+
|
|
192
|
+
- **`tags list`**: List all tags.
|
|
193
|
+
- Options: `--host`, `--raw`
|
|
194
|
+
- **`tags get`**: Get saves by tag.
|
|
195
|
+
- Options: `--host`, `--raw`
|
|
196
|
+
- **`tags add`**: Add a tag to a save.
|
|
197
|
+
- Options: `--host`
|
|
198
|
+
- **`tags remove`**: Remove a tag from a save.
|
|
199
|
+
- Options: `--host`
|
|
200
|
+
|
|
201
|
+
### AI Features
|
|
202
|
+
|
|
203
|
+
- **`ai analyse`**: Re-analyze a specific save or piped saves to update AI metadata.
|
|
204
|
+
- Options: `--host`, `--raw`, `--summary`
|
|
205
|
+
- **`ai all`**: Re-analyze all saves to update AI metadata.
|
|
206
|
+
- Options: `--delay`, `--limit`, `--offset`, `--host`
|
|
207
|
+
|
|
208
|
+
### Command Piping
|
|
209
|
+
|
|
210
|
+
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.
|
|
211
|
+
|
|
212
|
+
Examples:
|
|
213
|
+
- Delete all posts related to "Football":
|
|
214
|
+
```bash
|
|
215
|
+
postlocker search "Football" --pipe | postlocker delete
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
- Analyze the first 10 saves:
|
|
219
|
+
```bash
|
|
220
|
+
postlocker list --limit 10 --pipe | postlocker ai analyse
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
- Add all Unity-related posts to a group (by id):
|
|
224
|
+
```bash
|
|
225
|
+
postlocker search "Unity" --pipe | postlocker groups get -a "1218471-1248917-12410897f34"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
- Export specific search results:
|
|
229
|
+
```bash
|
|
230
|
+
postlocker search "important" --pipe | postlocker export -o important.json
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
- Import saves and add them to the "Newly imported" group (by id):
|
|
234
|
+
```bash
|
|
235
|
+
postlocker import data.csv --pipe | postlocker groups get "1209145-158-13258-91851f" -a
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Commands that support `--pipe` output:
|
|
239
|
+
- `list`: List all saves
|
|
240
|
+
- `search`: Search for saves
|
|
241
|
+
- `groups get`: List saves in a group
|
|
242
|
+
- `import`: After importing saves
|
|
243
|
+
|
|
244
|
+
Commands that accept piped input:
|
|
245
|
+
- `delete`: Delete saves
|
|
246
|
+
- `ai analyse`: Analyze saves
|
|
247
|
+
- `export`: Export specific saves
|
|
248
|
+
- `groups get --add`: Add saves to a group
|
|
249
|
+
|
|
250
|
+
## Admin Privileges
|
|
251
|
+
|
|
252
|
+
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.
|
|
253
|
+
|
|
254
|
+
For more detailed information on each command, use the `--help` option with the command, e.g., `postlocker groups get --help`.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# PostLocker CLI
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [PostLocker CLI](#postlocker-cli)
|
|
8
|
+
- [Table of Contents](#table-of-contents)
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [From Source](#from-source)
|
|
11
|
+
- [From PyPI](#from-pypi)
|
|
12
|
+
- [Usage](#usage)
|
|
13
|
+
- [Commands](#commands)
|
|
14
|
+
- [Common options](#common-options)
|
|
15
|
+
- [Tokens](#tokens)
|
|
16
|
+
- [Content Management](#content-management)
|
|
17
|
+
- [Groups](#groups)
|
|
18
|
+
- [Users](#users)
|
|
19
|
+
- [Tags](#tags)
|
|
20
|
+
- [AI Features](#ai-features)
|
|
21
|
+
- [Command Piping](#command-piping)
|
|
22
|
+
- [Admin Privileges](#admin-privileges)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### From Source
|
|
27
|
+
|
|
28
|
+
1. Clone the repository:
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/yourusername/postlocker-cli.git
|
|
31
|
+
cd postlocker-cli
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
2. Install the dependencies:
|
|
35
|
+
```bash
|
|
36
|
+
pip install -r requirements.txt
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
3. Install the package (add `[cli]` for the CLI):
|
|
40
|
+
```bash
|
|
41
|
+
pip install .[cli]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### From PyPI
|
|
45
|
+
|
|
46
|
+
- **Library only:** `pip install postlocker`
|
|
47
|
+
- **Library + CLI:** `pip install postlocker[cli]`
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
Once installed, you can use the `postlocker` command to interact with the CLI. Use `postlocker --help` to see the available commands and options.
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
### Common options
|
|
56
|
+
`--host` : Pick the base PostLocker host (defaults to production `https://api.postlocker.app`)
|
|
57
|
+
|
|
58
|
+
`--raw` : Print the results as raw JSON from the API
|
|
59
|
+
|
|
60
|
+
`--summary` : Show AI-generated summaries for content (available in list and search commands)
|
|
61
|
+
|
|
62
|
+
`--limit`: Limit the amount of results listed, list the first X items. (use with `--offset` to create paging)
|
|
63
|
+
|
|
64
|
+
`--offset`: start the listing after skipping the first X items (use with `--limit` to create paging)
|
|
65
|
+
|
|
66
|
+
### Tokens
|
|
67
|
+
|
|
68
|
+
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.
|
|
69
|
+
|
|
70
|
+
Tokens are safely encrypted and saved hidden in your home folder `~/.postlocker/tokens.json`
|
|
71
|
+
|
|
72
|
+
- **`tokens clear`**: Clear all cached tokens.
|
|
73
|
+
- **`tokens list`**: List all cached tokens.
|
|
74
|
+
|
|
75
|
+
### Content Management
|
|
76
|
+
|
|
77
|
+
- **`save`**: Save content to PostLocker.
|
|
78
|
+
- Options: `--title`, `--description`, `--tags`, `--host`
|
|
79
|
+
- **`delete`**: Delete content from PostLocker by ID.
|
|
80
|
+
- Options: `--host`
|
|
81
|
+
- **`list`**: List all saved content.
|
|
82
|
+
- Options: `--host`, `--raw`, `--summary`, `--pipe`, `--limit`, `--offset`, `--since`, `--content-type`
|
|
83
|
+
- Note: The `--since` option 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 `--pipe` or `--raw` it will only output the updated saves.
|
|
84
|
+
- The `--content-type` option filters saves by their content type
|
|
85
|
+
- **`get`**: Get content by ID.
|
|
86
|
+
- Options: `--host`
|
|
87
|
+
- **`search`**: Search saved content.
|
|
88
|
+
- Options: `--limit`, `--semantic`, `--distance`, `--host`, `--raw`, `--summary`, `--pipe`, `--content-type`
|
|
89
|
+
- The `--content-type` option filters search results by their content type
|
|
90
|
+
- **`export`**: Export saved content to JSON or CSV format.
|
|
91
|
+
- Options: `--output`, `--format`, `--host`, `--pretty`, `--limit`, `--offset`
|
|
92
|
+
- **`import`**: Import content from a CSV file.
|
|
93
|
+
- Options: `--host`, `--delay`, `--limit`, `--offset`, `--pipe`
|
|
94
|
+
- **`clear`**: Delete ALL saves and groups from your account (WARNING: DESTRUCTIVE ACTION).
|
|
95
|
+
- Options: `--host`
|
|
96
|
+
|
|
97
|
+
### Groups
|
|
98
|
+
|
|
99
|
+
- **`groups list`**: List all content groups.
|
|
100
|
+
- Options: `--host`, `--raw`
|
|
101
|
+
- **`groups get ID [SAVE_IDS]`**: Get content from a specific group or modify group contents.
|
|
102
|
+
- Options:
|
|
103
|
+
- `--add, -a`: Add the specified save IDs to this group
|
|
104
|
+
- `--delete, -d`: Remove the specified save IDs from this group
|
|
105
|
+
- `--host, -h`: PostLocker host URL
|
|
106
|
+
- `--raw`: Display full JSON data
|
|
107
|
+
- `--pipe`: Output only save IDs for piping
|
|
108
|
+
- `--limit, -l`: Limit the number of saves to display
|
|
109
|
+
- `--offset, -s`: Number of saves to skip
|
|
110
|
+
- `--summary`: Show AI summary for each save
|
|
111
|
+
- Note: `--add` and `--delete` cannot be used together
|
|
112
|
+
- Examples:
|
|
113
|
+
- View group contents: `postlocker groups get "550e8400-e29b-41d4-a716-446655440000"`
|
|
114
|
+
- Add saves to group: `postlocker groups get "550e8400-e29b-41d4-a716-446655444020" "123" "456" --add`
|
|
115
|
+
- Remove from group: `postlocker groups get "8a7b3c4d-5e6f-7g8h-9i0j-123456789abc" "123" --delete`
|
|
116
|
+
- Pipe search results to group: `postlocker search "topic" --pipe | postlocker groups get "9b8a7c6d-5e4f-3g2h-1i0j-abcdef123456" --add`
|
|
117
|
+
- **`groups create`**: Create a new group.
|
|
118
|
+
- Options: `--host`
|
|
119
|
+
- **`groups rm`**: Delete a group.
|
|
120
|
+
- Options: `--host`
|
|
121
|
+
|
|
122
|
+
### Users
|
|
123
|
+
|
|
124
|
+
- **`users me`**: Get current user information.
|
|
125
|
+
- Options: `--host`, `--raw`
|
|
126
|
+
- **`users list`**: List all users (admin only).
|
|
127
|
+
- Options:
|
|
128
|
+
- `--host`: PostLocker host URL
|
|
129
|
+
- `--raw`: Display full JSON data
|
|
130
|
+
- `--limit, -l`: Limit the number of users to display
|
|
131
|
+
- `--offset, -o`: Number of users to skip
|
|
132
|
+
- `--include-length`: Include the number of saves for each user in the output
|
|
133
|
+
- **`users create`**: Create a new user or batch create users from piped input.
|
|
134
|
+
- Options:
|
|
135
|
+
- `--host`: PostLocker host URL
|
|
136
|
+
- `--pipe`: Read email addresses from standard input
|
|
137
|
+
- `--yes, -y`: Automatically generate passwords without prompting
|
|
138
|
+
- `--delay`: Delay in seconds between creating users in batch (default: 0.5)
|
|
139
|
+
- Examples:
|
|
140
|
+
- Create single user (will prompt for password):
|
|
141
|
+
\```bash
|
|
142
|
+
postlocker users create
|
|
143
|
+
\```
|
|
144
|
+
- Create multiple users from a file with auto-generated passwords:
|
|
145
|
+
\```bash
|
|
146
|
+
cat accounts.txt | postlocker users create --pipe -y
|
|
147
|
+
\```
|
|
148
|
+
- Create users with custom delay between creations:
|
|
149
|
+
\```bash
|
|
150
|
+
cat accounts.txt | postlocker users create --pipe -y --delay 1.0
|
|
151
|
+
\```
|
|
152
|
+
- 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.
|
|
153
|
+
- **`users set-admin`**: Set user as admin.
|
|
154
|
+
- Options: `--host`
|
|
155
|
+
- **`users set-active`**: Set user as active.
|
|
156
|
+
- Options: `--host`
|
|
157
|
+
- **`users reset-password`**: Reset user password.
|
|
158
|
+
- Options: `--host`
|
|
159
|
+
- Note: Passwords are securely prompted and require confirmation.
|
|
160
|
+
|
|
161
|
+
### Tags
|
|
162
|
+
|
|
163
|
+
- **`tags list`**: List all tags.
|
|
164
|
+
- Options: `--host`, `--raw`
|
|
165
|
+
- **`tags get`**: Get saves by tag.
|
|
166
|
+
- Options: `--host`, `--raw`
|
|
167
|
+
- **`tags add`**: Add a tag to a save.
|
|
168
|
+
- Options: `--host`
|
|
169
|
+
- **`tags remove`**: Remove a tag from a save.
|
|
170
|
+
- Options: `--host`
|
|
171
|
+
|
|
172
|
+
### AI Features
|
|
173
|
+
|
|
174
|
+
- **`ai analyse`**: Re-analyze a specific save or piped saves to update AI metadata.
|
|
175
|
+
- Options: `--host`, `--raw`, `--summary`
|
|
176
|
+
- **`ai all`**: Re-analyze all saves to update AI metadata.
|
|
177
|
+
- Options: `--delay`, `--limit`, `--offset`, `--host`
|
|
178
|
+
|
|
179
|
+
### Command Piping
|
|
180
|
+
|
|
181
|
+
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.
|
|
182
|
+
|
|
183
|
+
Examples:
|
|
184
|
+
- Delete all posts related to "Football":
|
|
185
|
+
```bash
|
|
186
|
+
postlocker search "Football" --pipe | postlocker delete
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- Analyze the first 10 saves:
|
|
190
|
+
```bash
|
|
191
|
+
postlocker list --limit 10 --pipe | postlocker ai analyse
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
- Add all Unity-related posts to a group (by id):
|
|
195
|
+
```bash
|
|
196
|
+
postlocker search "Unity" --pipe | postlocker groups get -a "1218471-1248917-12410897f34"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
- Export specific search results:
|
|
200
|
+
```bash
|
|
201
|
+
postlocker search "important" --pipe | postlocker export -o important.json
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- Import saves and add them to the "Newly imported" group (by id):
|
|
205
|
+
```bash
|
|
206
|
+
postlocker import data.csv --pipe | postlocker groups get "1209145-158-13258-91851f" -a
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Commands that support `--pipe` output:
|
|
210
|
+
- `list`: List all saves
|
|
211
|
+
- `search`: Search for saves
|
|
212
|
+
- `groups get`: List saves in a group
|
|
213
|
+
- `import`: After importing saves
|
|
214
|
+
|
|
215
|
+
Commands that accept piped input:
|
|
216
|
+
- `delete`: Delete saves
|
|
217
|
+
- `ai analyse`: Analyze saves
|
|
218
|
+
- `export`: Export specific saves
|
|
219
|
+
- `groups get --add`: Add saves to a group
|
|
220
|
+
|
|
221
|
+
## Admin Privileges
|
|
222
|
+
|
|
223
|
+
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.
|
|
224
|
+
|
|
225
|
+
For more detailed information on each command, use the `--help` option with the command, e.g., `postlocker groups get --help`.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""PostLocker Python SDK - API client and CLI for PostLocker saved content."""
|
|
2
|
+
|
|
3
|
+
from postlocker.postlocker import (
|
|
4
|
+
PostLocker,
|
|
5
|
+
PostLockerException,
|
|
6
|
+
PostLockerLoginException,
|
|
7
|
+
PostLockerSaveException,
|
|
8
|
+
PostLockerDeleteException,
|
|
9
|
+
generate_password,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__version__ = "1.0.0"
|
|
13
|
+
__all__ = [
|
|
14
|
+
"PostLocker",
|
|
15
|
+
"PostLockerException",
|
|
16
|
+
"PostLockerLoginException",
|
|
17
|
+
"PostLockerSaveException",
|
|
18
|
+
"PostLockerDeleteException",
|
|
19
|
+
"generate_password",
|
|
20
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""CLI module for PostLocker."""
|