alfred-python 0.6.3__tar.gz → 0.7.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.
Files changed (71) hide show
  1. {alfred_python-0.6.3 → alfred_python-0.7.0}/LICENSE +1 -1
  2. alfred_python-0.7.0/PKG-INFO +148 -0
  3. alfred_python-0.7.0/README.md +101 -0
  4. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/base/config.py +2 -1
  5. alfred_python-0.7.0/alfred/base/constants.py +159 -0
  6. alfred_python-0.7.0/alfred/base/exceptions.py +5 -0
  7. alfred_python-0.7.0/alfred/exceptions/__init__.py +470 -0
  8. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/http/http_client.py +255 -73
  9. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/http/typed.py +1 -0
  10. alfred_python-0.7.0/alfred/realtime/__init__.py +245 -0
  11. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/__init__.py +14 -0
  12. alfred_python-0.7.0/alfred/rest/classifications/__init__.py +15 -0
  13. alfred_python-0.7.0/alfred/rest/classifications/base.py +55 -0
  14. alfred_python-0.7.0/alfred/rest/classifications/typed.py +145 -0
  15. alfred_python-0.7.0/alfred/rest/classifications/v1.py +77 -0
  16. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/data_points/__init__.py +1 -0
  17. alfred_python-0.7.0/alfred/rest/data_points/base.py +21 -0
  18. alfred_python-0.7.0/alfred/rest/data_points/typed.py +109 -0
  19. alfred_python-0.7.0/alfred/rest/data_points/v1.py +31 -0
  20. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/files/base.py +4 -2
  21. alfred_python-0.7.0/alfred/rest/files/typed.py +144 -0
  22. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/files/v1.py +47 -13
  23. alfred_python-0.7.0/alfred/rest/jobs/base.py +126 -0
  24. alfred_python-0.7.0/alfred/rest/jobs/typed.py +173 -0
  25. alfred_python-0.7.0/alfred/rest/jobs/v1.py +388 -0
  26. alfred_python-0.7.0/alfred_python.egg-info/PKG-INFO +148 -0
  27. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred_python.egg-info/SOURCES.txt +19 -1
  28. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred_python.egg-info/requires.txt +5 -4
  29. {alfred_python-0.6.3 → alfred_python-0.7.0}/pyproject.toml +15 -6
  30. alfred_python-0.7.0/tests/test_classifications.py +483 -0
  31. alfred_python-0.7.0/tests/test_client.py +166 -0
  32. alfred_python-0.7.0/tests/test_config.py +69 -0
  33. alfred_python-0.7.0/tests/test_constants.py +83 -0
  34. alfred_python-0.7.0/tests/test_data_points.py +341 -0
  35. alfred_python-0.7.0/tests/test_exceptions.py +509 -0
  36. alfred_python-0.7.0/tests/test_files.py +592 -0
  37. alfred_python-0.7.0/tests/test_http_client.py +1201 -0
  38. alfred_python-0.7.0/tests/test_jobs.py +639 -0
  39. alfred_python-0.7.0/tests/test_logging.py +188 -0
  40. alfred_python-0.7.0/tests/test_realtime.py +879 -0
  41. alfred_python-0.7.0/tests/test_sessions.py +77 -0
  42. alfred_python-0.7.0/tests/test_smoke.py +97 -0
  43. alfred_python-0.6.3/PKG-INFO +0 -416
  44. alfred_python-0.6.3/README.md +0 -377
  45. alfred_python-0.6.3/alfred/base/constants.py +0 -94
  46. alfred_python-0.6.3/alfred/base/exceptions.py +0 -11
  47. alfred_python-0.6.3/alfred/exceptions/__init__.py +0 -7
  48. alfred_python-0.6.3/alfred/realtime/__init__.py +0 -132
  49. alfred_python-0.6.3/alfred/rest/data_points/base.py +0 -14
  50. alfred_python-0.6.3/alfred/rest/data_points/v1.py +0 -21
  51. alfred_python-0.6.3/alfred/rest/files/typed.py +0 -71
  52. alfred_python-0.6.3/alfred/rest/jobs/base.py +0 -34
  53. alfred_python-0.6.3/alfred/rest/jobs/typed.py +0 -15
  54. alfred_python-0.6.3/alfred/rest/jobs/v1.py +0 -48
  55. alfred_python-0.6.3/alfred_python.egg-info/PKG-INFO +0 -416
  56. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/__init__.py +0 -0
  57. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/base/__init__.py +0 -0
  58. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/base/typed.py +0 -0
  59. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/http/__init__.py +0 -0
  60. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/files/__init__.py +0 -0
  61. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/jobs/__init__.py +0 -0
  62. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/sessions/__init__.py +0 -0
  63. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/sessions/base.py +0 -0
  64. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/rest/sessions/v1.py +0 -0
  65. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/typings/__init__.py +0 -0
  66. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/typings/misc.py +0 -0
  67. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/utils/__init__.py +0 -0
  68. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred/utils/logging.py +0 -0
  69. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred_python.egg-info/dependency_links.txt +0 -0
  70. {alfred_python-0.6.3 → alfred_python-0.7.0}/alfred_python.egg-info/top_level.txt +0 -0
  71. {alfred_python-0.6.3 → alfred_python-0.7.0}/setup.cfg +0 -0
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 The Python Packaging Authority
1
+ Copyright (c) 2026 Tagshelf LLC
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: alfred-python
3
+ Version: 0.7.0
4
+ Summary: Python library designed to simplify and streamline interactions with the Alfred API
5
+ Author-email: Tagshelf LLC <support@tagshelf.com>
6
+ License: Copyright (c) 2026 Tagshelf LLC
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ Project-URL: homepage, https://github.com/tagshelfsrl/alfred-python
26
+ Project-URL: documentation, https://github.com/tagshelfsrl/alfred-python/tree/master/docs
27
+ Classifier: Programming Language :: Python :: 3
28
+ Classifier: Programming Language :: Python :: 3.10
29
+ Classifier: Programming Language :: Python :: 3.11
30
+ Classifier: Programming Language :: Python :: 3.12
31
+ Classifier: Programming Language :: Python :: 3.13
32
+ Classifier: Programming Language :: Python :: 3.14
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Requires-Python: >=3.10
36
+ Description-Content-Type: text/markdown
37
+ License-File: LICENSE
38
+ Requires-Dist: requests>=2.33.0
39
+ Requires-Dist: urllib3>=2.8.0
40
+ Requires-Dist: python-socketio>=5.16.2
41
+ Requires-Dist: websocket-client>=1.8
42
+ Requires-Dist: certifi>=2026.10.18
43
+ Requires-Dist: idna>=3.15
44
+ Requires-Dist: python-magic==0.4.27; platform_system != "Windows"
45
+ Requires-Dist: python-magic-bin==0.4.14; platform_system == "Windows"
46
+ Dynamic: license-file
47
+
48
+ # alfred-python
49
+
50
+ `alfred-python` is the Python client for the Alfred (TagShelf) REST API and its real-time event stream. It wraps the endpoints for sessions, files, jobs, data points and standalone classification, handles authentication, retries and rate-limit throttling, and can push job and file events to your code as they happen.
51
+
52
+ ## Install
53
+
54
+ ```bash
55
+ pip install alfred-python
56
+ ```
57
+
58
+ The SDK detects the type of every local file you upload with `python-magic`, which needs the `libmagic` system library. The SDK loads it when you import `alfred.rest`, so a missing library shows up as an import error:
59
+
60
+ - Debian and Ubuntu: `apt-get install libmagic1`
61
+ - macOS: `brew install libmagic`
62
+ - Windows: nothing to install. The SDK depends on `python-magic-bin`, which bundles the library.
63
+
64
+ Supported Python versions are listed in [docs/compatibility.md](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/compatibility.md).
65
+
66
+ ## Quickstart
67
+
68
+ Upload a local file, process it as a job and read the extracted data points. You need an API key (see [authentication](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/authentication.md)).
69
+
70
+ ```python
71
+ import time
72
+
73
+ from alfred.base.config import Configuration
74
+ from alfred.http.typed import AuthConfiguration
75
+ from alfred.rest import AlfredClient
76
+
77
+ client = AlfredClient(
78
+ config=Configuration.v1(),
79
+ auth_config=AuthConfiguration({"api_key": "YOUR_API_KEY"}),
80
+ )
81
+
82
+ session_id = client.sessions.create()["session_id"]
83
+
84
+ with open("invoice.pdf", "rb") as local_file:
85
+ file_id = client.files.upload_file(
86
+ {"file": local_file, "session_id": session_id}
87
+ )["file_id"]
88
+
89
+ job_id = client.jobs.create({"session_id": session_id})["job_id"]
90
+
91
+ stopped = ("completed", "failed", "invalid", "canceled", "expired")
92
+ while client.jobs.get(job_id)["stage"] not in stopped:
93
+ time.sleep(5)
94
+
95
+ print(client.data_points.get_values(file_id))
96
+ ```
97
+
98
+ Polling is the simplest way to wait. To be notified instead, use the [real-time client](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/realtime.md). [Getting started](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/getting-started.md) explains each step.
99
+
100
+ ## Documentation
101
+
102
+ Every page stands on its own. Start at the [documentation index](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/README.md).
103
+
104
+ | Page | What it covers |
105
+ | --- | --- |
106
+ | [Getting started](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/getting-started.md) | Install, create a client, and an end-to-end walkthrough from session to results. |
107
+ | [Authentication](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/authentication.md) | API key, OAuth (username and password) and HMAC; the `ALFRED_API_KEY` environment variable. |
108
+ | [Configuration](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/configuration.md) | Base URLs, HTTP settings (timeout, retries, throttling), response types, logging and custom HTTP clients. |
109
+ | [Files](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/files.md) | Upload local files and remote URLs, read file details, download the original. |
110
+ | [Sessions](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/sessions.md) | Deferred sessions: group several uploads into one job. |
111
+ | [Jobs](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/jobs.md) | Create jobs, read their status, list them, and cancel, restart or check the sources of a job. |
112
+ | [Data points](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/data-points.md) | Read the values Alfred extracted from a file, with their confidence and validation results. |
113
+ | [Classification](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/classification.md) | Standalone classification: classify a text or a file against criteria you send with the request, without setting up document types first. |
114
+ | [Real-time events](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/realtime.md) | Subscribe to job and file events over a socket; the full event catalogue. |
115
+ | [Error handling](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/errors.md) | What the SDK raises and how to handle it. |
116
+ | [Compatibility](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/compatibility.md) | Supported Python versions and dependency policy. |
117
+
118
+ ## Development
119
+
120
+ Install the pinned dependencies, then run the tests:
121
+
122
+ ```bash
123
+ pip install -r requirements.txt
124
+ python -m unittest
125
+ ```
126
+
127
+ The unit tests (`tests/test_*.py`) need no credentials and never leave your machine. `tests/__init__.py` holds integration tests that call a real Alfred environment. They create a session and a job, so point them at a test tenant. They are skipped unless `ALFRED_API_KEY` is set. The variables they read:
128
+
129
+ | Variable | Default | Meaning |
130
+ | --- | --- | --- |
131
+ | `ALFRED_API_KEY` | none | API key. Without it the integration tests are skipped. |
132
+ | `ALFRED_BASE_URL` | `https://app.tagshelf.com` | Alfred environment to call. |
133
+ | `ALFRED_TEST_FILE_ID` | none | A file ID for `test_get_file`. The test is skipped when unset. |
134
+ | `ALFRED_TEST_UPLOAD_FILE` | none | Path of a local file for `test_upload_file`. The test is skipped when unset. |
135
+
136
+ Run one integration test with, for example, `python -m unittest tests.TestMain.test_get_file`.
137
+
138
+ Build the source distribution and wheel into `dist/` with `make build` (it runs `python -m build`). `make test` runs the unit tests and `make clean` removes build output.
139
+
140
+ ## Contributing
141
+
142
+ - Pull requests target the `development` branch. `master` holds reviewed releases, which are published from it.
143
+ - Pull request titles are checked for a semantic prefix: `chore`, `docs`, `fix`, `feat`, `misc`, `test` or `release`, for example `fix(files): keep the original file name`.
144
+ - The test suite runs on every pull request. Add or update tests with your change, and update the matching page in `docs/` when behaviour changes.
145
+
146
+ ## License
147
+
148
+ MIT. See [LICENSE](https://github.com/tagshelfsrl/alfred-python/blob/master/LICENSE).
@@ -0,0 +1,101 @@
1
+ # alfred-python
2
+
3
+ `alfred-python` is the Python client for the Alfred (TagShelf) REST API and its real-time event stream. It wraps the endpoints for sessions, files, jobs, data points and standalone classification, handles authentication, retries and rate-limit throttling, and can push job and file events to your code as they happen.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install alfred-python
9
+ ```
10
+
11
+ The SDK detects the type of every local file you upload with `python-magic`, which needs the `libmagic` system library. The SDK loads it when you import `alfred.rest`, so a missing library shows up as an import error:
12
+
13
+ - Debian and Ubuntu: `apt-get install libmagic1`
14
+ - macOS: `brew install libmagic`
15
+ - Windows: nothing to install. The SDK depends on `python-magic-bin`, which bundles the library.
16
+
17
+ Supported Python versions are listed in [docs/compatibility.md](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/compatibility.md).
18
+
19
+ ## Quickstart
20
+
21
+ Upload a local file, process it as a job and read the extracted data points. You need an API key (see [authentication](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/authentication.md)).
22
+
23
+ ```python
24
+ import time
25
+
26
+ from alfred.base.config import Configuration
27
+ from alfred.http.typed import AuthConfiguration
28
+ from alfred.rest import AlfredClient
29
+
30
+ client = AlfredClient(
31
+ config=Configuration.v1(),
32
+ auth_config=AuthConfiguration({"api_key": "YOUR_API_KEY"}),
33
+ )
34
+
35
+ session_id = client.sessions.create()["session_id"]
36
+
37
+ with open("invoice.pdf", "rb") as local_file:
38
+ file_id = client.files.upload_file(
39
+ {"file": local_file, "session_id": session_id}
40
+ )["file_id"]
41
+
42
+ job_id = client.jobs.create({"session_id": session_id})["job_id"]
43
+
44
+ stopped = ("completed", "failed", "invalid", "canceled", "expired")
45
+ while client.jobs.get(job_id)["stage"] not in stopped:
46
+ time.sleep(5)
47
+
48
+ print(client.data_points.get_values(file_id))
49
+ ```
50
+
51
+ Polling is the simplest way to wait. To be notified instead, use the [real-time client](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/realtime.md). [Getting started](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/getting-started.md) explains each step.
52
+
53
+ ## Documentation
54
+
55
+ Every page stands on its own. Start at the [documentation index](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/README.md).
56
+
57
+ | Page | What it covers |
58
+ | --- | --- |
59
+ | [Getting started](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/getting-started.md) | Install, create a client, and an end-to-end walkthrough from session to results. |
60
+ | [Authentication](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/authentication.md) | API key, OAuth (username and password) and HMAC; the `ALFRED_API_KEY` environment variable. |
61
+ | [Configuration](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/configuration.md) | Base URLs, HTTP settings (timeout, retries, throttling), response types, logging and custom HTTP clients. |
62
+ | [Files](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/files.md) | Upload local files and remote URLs, read file details, download the original. |
63
+ | [Sessions](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/sessions.md) | Deferred sessions: group several uploads into one job. |
64
+ | [Jobs](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/jobs.md) | Create jobs, read their status, list them, and cancel, restart or check the sources of a job. |
65
+ | [Data points](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/data-points.md) | Read the values Alfred extracted from a file, with their confidence and validation results. |
66
+ | [Classification](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/classification.md) | Standalone classification: classify a text or a file against criteria you send with the request, without setting up document types first. |
67
+ | [Real-time events](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/realtime.md) | Subscribe to job and file events over a socket; the full event catalogue. |
68
+ | [Error handling](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/errors.md) | What the SDK raises and how to handle it. |
69
+ | [Compatibility](https://github.com/tagshelfsrl/alfred-python/blob/master/docs/compatibility.md) | Supported Python versions and dependency policy. |
70
+
71
+ ## Development
72
+
73
+ Install the pinned dependencies, then run the tests:
74
+
75
+ ```bash
76
+ pip install -r requirements.txt
77
+ python -m unittest
78
+ ```
79
+
80
+ The unit tests (`tests/test_*.py`) need no credentials and never leave your machine. `tests/__init__.py` holds integration tests that call a real Alfred environment. They create a session and a job, so point them at a test tenant. They are skipped unless `ALFRED_API_KEY` is set. The variables they read:
81
+
82
+ | Variable | Default | Meaning |
83
+ | --- | --- | --- |
84
+ | `ALFRED_API_KEY` | none | API key. Without it the integration tests are skipped. |
85
+ | `ALFRED_BASE_URL` | `https://app.tagshelf.com` | Alfred environment to call. |
86
+ | `ALFRED_TEST_FILE_ID` | none | A file ID for `test_get_file`. The test is skipped when unset. |
87
+ | `ALFRED_TEST_UPLOAD_FILE` | none | Path of a local file for `test_upload_file`. The test is skipped when unset. |
88
+
89
+ Run one integration test with, for example, `python -m unittest tests.TestMain.test_get_file`.
90
+
91
+ Build the source distribution and wheel into `dist/` with `make build` (it runs `python -m build`). `make test` runs the unit tests and `make clean` removes build output.
92
+
93
+ ## Contributing
94
+
95
+ - Pull requests target the `development` branch. `master` holds reviewed releases, which are published from it.
96
+ - Pull request titles are checked for a semantic prefix: `chore`, `docs`, `fix`, `feat`, `misc`, `test` or `release`, for example `fix(files): keep the original file name`.
97
+ - The test suite runs on every pull request. Add or update tests with your change, and update the matching page in `docs/` when behaviour changes.
98
+
99
+ ## License
100
+
101
+ MIT. See [LICENSE](https://github.com/tagshelfsrl/alfred-python/blob/master/LICENSE).
@@ -8,8 +8,9 @@ class ConfigurationDict(TypedDict):
8
8
  version: int
9
9
 
10
10
 
11
- class OverridesDict(TypedDict):
11
+ class OverridesDict(TypedDict, total=False):
12
12
  base_url: Optional[Text]
13
+ realtime_url: Optional[Text]
13
14
 
14
15
 
15
16
  class Configuration:
@@ -0,0 +1,159 @@
1
+ from enum import Enum
2
+
3
+ from alfred.base.typed import ResponseType
4
+
5
+ # Response type/header mapping
6
+ RESPONSE_TYPE_HEADER_MAPPING = {
7
+ ResponseType.JSON: "application/json",
8
+ ResponseType.TEXT: "text/plain",
9
+ ResponseType.XML: "application/xml",
10
+ }
11
+
12
+
13
+ class EventType(Enum):
14
+ """
15
+ Enumeration of event types.
16
+ """
17
+ JOB_EVENT = "job_event"
18
+ FILE_EVENT = "file_event"
19
+
20
+
21
+ class FileEvent(Enum):
22
+ """
23
+ Events of the file event stream (`file_event`). Each value is the
24
+ `event_name` Alfred puts in the event data, except FILE_REMOVE_TAG_EVENT,
25
+ which Alfred sends under the name of another event (see its comment).
26
+ """
27
+ # Defined by the platform; Alfred 1.130.0 does not send it.
28
+ FILE_CREATE_EVENT = "alfred_event_file_create"
29
+
30
+ # Triggered when a file is added to a job for processing.
31
+ FILE_ADD_TO_JOB_EVENT = "alfred_event_file_added_to_job"
32
+
33
+ # Occurs when a new category is created for a file.
34
+ FILE_CATEGORY_CREATE_EVENT = "alfred_event_file_category_create"
35
+
36
+ # Signals the deletion of a file's category.
37
+ FILE_CATEGORY_DELETE_EVENT = "alfred_event_file_category_delete"
38
+
39
+ # Indicates a change in the tag associated with a file. Alfred sends tag
40
+ # removals under this name too (see FILE_REMOVE_TAG_EVENT).
41
+ FILE_CHANGE_TAG_EVENT = "alfred_event_file_change_tag"
42
+
43
+ # Signals that a file was decomposed into other files.
44
+ FILE_DECOMPOSED_EVENT = "alfred_event_file_decomposed"
45
+
46
+ # Marks the completion of file processing.
47
+ FILE_DONE_EVENT = "alfred_event_file_done"
48
+
49
+ # Triggered when new data is extracted from a file.
50
+ FILE_EXTRACTED_DATA_CREATE_EVENT = "alfred_event_file_extracted_data_create"
51
+
52
+ # Occurs when extracted data from a file is deleted.
53
+ FILE_EXTRACTED_DATA_DELETE_EVENT = "alfred_event_file_extracted_data_delete"
54
+
55
+ # Indicates a failure in file processing.
56
+ FILE_FAILED_EVENT = "alfred_event_file_failed"
57
+
58
+ # Signals the movement of a file within the system.
59
+ FILE_MOVE_EVENT = "alfred_event_file_move"
60
+
61
+ # Triggered when a file is moved to the decomposed state.
62
+ FILE_MOVE_TO_DECOMPOSED_EVENT = "alfred_event_file_move_to_decomposed"
63
+
64
+ # Triggered when a file is moved to a pending state.
65
+ FILE_MOVE_TO_PENDING_EVENT = "alfred_event_file_move_to_pending"
66
+
67
+ # Indicates movement of a file to the recycle bin.
68
+ FILE_MOVE_TO_RECYCLE_BIN_EVENT = "alfred_event_file_move_to_recycle_bin"
69
+
70
+ # Reflects the creation of a file property.
71
+ FILE_PROPERTY_CREATE_EVENT = "alfred_event_file_property_create"
72
+
73
+ # Signals the deletion of a file property.
74
+ FILE_PROPERTY_DELETE_EVENT = "alfred_event_file_property_delete"
75
+
76
+ # Signals the removal of a tag from a file. Alfred has no event name of its
77
+ # own for this: it sends `alfred_event_file_change_tag` with
78
+ # `tag_being_removed_id` in the data. The value below is the SDK's name for
79
+ # the subscription, and the real-time client delivers those events to it.
80
+ FILE_REMOVE_TAG_EVENT = "alfred_event_file_remove_tag"
81
+
82
+ # Indicates an update in the file's status.
83
+ FILE_STATUS_UPDATE_EVENT = "alfred_event_file_status_update"
84
+
85
+ # Defined by the platform; Alfred 1.130.0 does not send it.
86
+ FILE_UPDATE_EVENT = "alfred_event_file_update"
87
+
88
+
89
+ class JobEvent(Enum):
90
+ """
91
+ Events of the job event stream (`job_event`). Each value is the
92
+ `event_name` Alfred puts in the event data, except
93
+ JOB_EXCEEDED_RETRIES_EVENT, which Alfred sends under the name of another
94
+ event (see its comment).
95
+ """
96
+ # Triggered when a new job is instantiated for file operations.
97
+ JOB_CREATE_EVENT = "alfred_event_job_create"
98
+
99
+ # Triggered when job begins its workflow and state machine.
100
+ JOB_START_EVENT = "alfred_event_job_start"
101
+
102
+ # Occurs when job transitions from one workflow stage to another.
103
+ JOB_STAGE_UPDATE_EVENT = "alfred_event_job_stage_update"
104
+
105
+ # Every event Alfred names `alfred_event_job_retry`. Alfred 1.130.0 sends
106
+ # it only after JOB_FAILED_EVENT, when the job has used up its retries
107
+ # (see JOB_EXCEEDED_RETRIES_EVENT), and not when a job is retried.
108
+ JOB_RETRY_EVENT = "alfred_event_job_retry"
109
+
110
+ # Fires when a job has used up its retries. Alfred has no event name of its
111
+ # own for this: it sends `alfred_event_job_retry` with `exceeded_retries`
112
+ # set to true. The value below is the SDK's name for the subscription, and
113
+ # the real-time client delivers those events to it.
114
+ JOB_EXCEEDED_RETRIES_EVENT = "alfred_event_job_exceeded_retries"
115
+
116
+ # Fires when job fails initial validation of input files or parameters.
117
+ JOB_INVALID_EVENT = "alfred_event_job_invalid"
118
+
119
+ # Occurs when a job halts due to an unrecoverable error.
120
+ JOB_FAILED_EVENT = "alfred_event_job_failed"
121
+
122
+ # Triggered when a job is cancelled.
123
+ JOB_CANCELLED_EVENT = "alfred_event_job_cancelled"
124
+
125
+ # Triggered when a job expires.
126
+ JOB_EXPIRED_EVENT = "alfred_event_job_expired"
127
+
128
+ # Triggered when job successfully completes all workflow stages.
129
+ JOB_FINISHED_EVENT = "alfred_event_job_finished"
130
+
131
+
132
+ # Event names used by earlier SDK versions, mapped to the values of the
133
+ # members above.
134
+ LEGACY_EVENT_NAMES = {
135
+ "file_add_to_job_event": "alfred_event_file_added_to_job",
136
+ "file_category_create_event": "alfred_event_file_category_create",
137
+ "file_category_delete_event": "alfred_event_file_category_delete",
138
+ "file_change_tag_event": "alfred_event_file_change_tag",
139
+ "file_done_event": "alfred_event_file_done",
140
+ "file_extracted_data_create_event": "alfred_event_file_extracted_data_create",
141
+ "file_extracted_data_delete_event": "alfred_event_file_extracted_data_delete",
142
+ "file_failed_event": "alfred_event_file_failed",
143
+ "file_move_event": "alfred_event_file_move",
144
+ "file_move_to_pending_event": "alfred_event_file_move_to_pending",
145
+ "file_move_to_recycle_bin_event": "alfred_event_file_move_to_recycle_bin",
146
+ "file_property_create_event": "alfred_event_file_property_create",
147
+ "file_property_delete_event": "alfred_event_file_property_delete",
148
+ "file_remove_tag_event": "alfred_event_file_remove_tag",
149
+ "file_status_update_event": "alfred_event_file_status_update",
150
+ "file_update_event": "alfred_event_file_update",
151
+ "job_create_event": "alfred_event_job_create",
152
+ "job_exceeded_retries_event": "alfred_event_job_exceeded_retries",
153
+ "job_failed_event": "alfred_event_job_failed",
154
+ "job_finished_event": "alfred_event_job_finished",
155
+ "job_invalid_event": "alfred_event_job_invalid",
156
+ "job_retry_event": "alfred_event_job_retry",
157
+ "job_stage_update_event": "alfred_event_job_stage_update",
158
+ "job_start_event": "alfred_event_job_start",
159
+ }
@@ -0,0 +1,5 @@
1
+ # The classes live in ``alfred.exceptions``; these names stay importable from
2
+ # here for existing code.
3
+ from alfred.exceptions import AlfredMissingArgument, AlfredMissingAuthException
4
+
5
+ __all__ = ["AlfredMissingAuthException", "AlfredMissingArgument"]