indico-cli 0.2.2__tar.gz → 0.4.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: indico-cli
3
- Version: 0.2.2
3
+ Version: 0.4.1
4
4
  Summary: CLI tool for interacting with Indico event management systems
5
5
  Project-URL: Repository, https://gitlab.cern.ch/cern-agent-skills/indico-cli
6
6
  License: MIT
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.2.2'
32
- __version_tuple__ = version_tuple = (0, 2, 2)
31
+ __version__ = version = '0.4.1'
32
+ __version_tuple__ = version_tuple = (0, 4, 1)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -71,10 +71,21 @@ def cli(ctx, base_url, token):
71
71
 
72
72
  @cli.command()
73
73
  @click.option("--base-url", required=True, help="Indico instance URL")
74
- @click.option("--token", default="", help="API bearer token")
74
+ @click.option("--token", envvar="INDICO_API_TOKEN", default="", help="API bearer token (or set INDICO_API_TOKEN)")
75
75
  def configure(base_url, token):
76
76
  """Configure connection to an Indico instance and test it."""
77
- api = IndicoAPI(base_url, bearer_token=token if token else None)
77
+ if not token:
78
+ try:
79
+ token = click.prompt("API token", hide_input=True)
80
+ except (EOFError, click.Abort):
81
+ pass
82
+ if not token:
83
+ click.echo("Error: no token provided.", err=True)
84
+ click.echo("Either:", err=True)
85
+ click.echo(" 1. Run in a real terminal: indico-cli configure --base-url URL", err=True)
86
+ click.echo(" 2. Set env var first: export INDICO_API_TOKEN=indp_... && indico-cli configure --base-url URL", err=True)
87
+ sys.exit(1)
88
+ api = IndicoAPI(base_url, bearer_token=token)
78
89
  client = IndicoClient(api)
79
90
  try:
80
91
  result = run_async(client.get_user_info())
@@ -84,6 +95,7 @@ def configure(base_url, token):
84
95
  click.echo(f"Configuration saved to {CONFIG_FILE}")
85
96
  except Exception as error:
86
97
  click.echo(f"Connection test failed: {error}", err=True)
98
+ click.echo("Check that your token starts with 'indp_' and has the correct scopes.", err=True)
87
99
  sys.exit(1)
88
100
 
89
101
 
@@ -23,11 +23,13 @@ Set up or update Indico CLI credentials.
23
23
 
24
24
  1. **Check if already configured**: run `uvx indico-cli user-info 2>&1`. If it returns user info, stop — already configured.
25
25
  2. **Ask the user** which Indico instance to connect to (e.g., `https://indico.cern.ch`, `https://indico.fnal.gov`, or a custom URL).
26
- 3. **Guide token creation**: tell the user to open `<base_url>/user/preferences/api`, click "Create new token", name it (e.g., "indico-cli"), select scopes `read:legacy_api`, `write:legacy_api`, `read:user`, click "Create", and copy the `indp_...` token immediately (shown only once).
26
+ 3. **Guide token creation**: tell the user to open `<base_url>/user/tokens/`, click "Create new token", name it (e.g., "indico-cli"), select all scopes (you can avoid write in case want to play on the safe side), click "Create", and copy the `indp_...` token immediately (shown only once).
27
27
  4. **Save credentials**:
28
+
28
29
  ```bash
29
30
  uvx indico-cli configure --base-url <BASE_URL> --token <TOKEN>
30
31
  ```
32
+
31
33
  Saves to `~/.config/indico-cli/config.json` (never inside a repo).
32
34
  5. **Verify**: the configure command tests the connection automatically. On failure: 403/401 = wrong scopes or expired token; connection error = wrong URL; SSL error = network issue.
33
35
 
@@ -44,6 +46,7 @@ If an event returns "not found" or "deleted", don't stop — use `search-by-term
44
46
  ### Chaining commands for deeper answers
45
47
 
46
48
  Many tasks require chaining multiple commands. For example, to find out what someone concluded in a talk:
49
+
47
50
  1. `search-by-term` or `contributions` to find the relevant contribution
48
51
  2. `files` or `download` to get the slides/PDF
49
52
  3. **Read the downloaded file** and extract the answer
@@ -53,6 +56,7 @@ The goal is to answer the user's question, not just list metadata. If slides wer
53
56
  ### Using event IDs from search results
54
57
 
55
58
  `search-by-term` returns `Event ID` for every contribution, attachment, and note result. Use this ID to drill into the event:
59
+
56
60
  1. `search-by-term --term "my topic"` — find the contribution and note its Event ID
57
61
  2. `event-details --event-id <ID>` — get full event info
58
62
  3. `contributions --event-id <ID>` — list all contributions
@@ -156,6 +160,7 @@ uvx indico-cli files --event-id <ID> [--download | --no-download] [--download-di
156
160
  | `--download-dir` | No | Directory for downloads |
157
161
 
158
162
  If the built-in download fails (403), list with `--no-download` to get URLs, then use curl:
163
+
159
164
  ```bash
160
165
  curl -L -H "Authorization: Bearer $INDICO_API_TOKEN" -o filename.pdf "DOWNLOAD_URL"
161
166
  ```
@@ -310,11 +315,13 @@ Used by `create-event-with-agenda`. A JSON array where items with a `contributio
310
315
  ## Examples
311
316
 
312
317
  Search for beam dynamics content:
318
+
313
319
  ```bash
314
320
  uvx indico-cli search-by-term --term "beam dynamics" --limit 5
315
321
  ```
316
322
 
317
323
  Create a meeting with agenda:
324
+
318
325
  ```bash
319
326
  uvx indico-cli create-event-with-agenda \
320
327
  --title "Workshop on ML" \
@@ -328,11 +335,13 @@ uvx indico-cli create-event-with-agenda \
328
335
  ```
329
336
 
330
337
  Download all files from an event:
338
+
331
339
  ```bash
332
340
  uvx indico-cli files --event-id 137346
333
341
  ```
334
342
 
335
343
  Schedule a contribution:
344
+
336
345
  ```bash
337
346
  uvx indico-cli add-timetable-entry --event-id 137346 --type contribution --object-id 12 --start 2025-06-15T14:00:00 --duration 30
338
347
  ```
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes