letsemploy-publisher
Python client for the letsemploy publisher GraphQL API. Requires Python 3.10+.
The employer is implied by the service token, so it is never passed as an argument.
Install
uv add letsemploy-publisher
Usage
from letsemploy_publisher import JobInput, JobType, PublisherClient, UserErrorsError
with PublisherClient(token="...") as client:
print(client.employer().name)
for job in client.iter_jobs(): # walks every page
print(job.id, job.title, job.presentation)
bern = client.locations(q="Bern")[0]
try:
job = client.create_job(
JobInput(
title="Python Engineer",
url="https://example.com/jobs/python",
language="de",
job_type=JobType.PERMANENT,
location_ids=[bern.id],
)
)
client.activate_job(job.id)
except UserErrorsError as exc:
for error in exc.user_errors:
print(error.field, error.code, error.message)
token and url fall back to the LETSEMPLOY_PUBLISHER_TOKEN and
LETSEMPLOY_PUBLISHER_URL environment variables; the URL defaults to
https://publisher.letsemploy.org/graphql.
An async client with the same methods is available:
from letsemploy_publisher import AsyncPublisherClient
async with AsyncPublisherClient() as client:
feeds = await client.feeds()
Errors
All exceptions derive from PublisherError:
| Exception | Raised when |
|---|---|
UserErrorsError |
A mutation returned userErrors; see .user_errors. |
AuthenticationError |
The token is missing or invalid (UNAUTHENTICATED). |
GraphQLError |
The response has a top-level errors array; see .errors, .code. |
TransportError |
Network failure, timeout or an unexpected HTTP response. |
Inputs and updates
updateJob, updateFeed, updatePermalink and updateEmployer replace the
whole object: every field of the input dataclass is sent, so a field left as
None is cleared.
Development
uv sync
uv run ruff format .
uv run ruff check .
uv run pytest
The tests validate every query and mutation against schema.graphql and check
that every root field of the schema is covered. When the API changes, refresh
the schema and run the tests:
curl -o schema.graphql http://localhost:8080/graphql/schema
uv run pytest
Metadata
Release files for letsemploy-publisher 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| letsemploy_publisher-0.1.0.tar.gz | 10.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| letsemploy_publisher-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / letsemploy_publisher-0.1.0.tar.gz
| Download URL | letsemploy_publisher-0.1.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4eb9bde2de549f2cb768a37dc541468547e84d50cbf9356bda64a9ee34ae0f47
|
|
BLAKE2b-256 checksum How to use checksums |
15bab7f6a161d2bd81c86d73e466e3759b877f061e309169b3ab2c4e31f8d0a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / letsemploy_publisher-0.1.0-py3-none-any.whl
| Download URL | letsemploy_publisher-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3dff2e8856e3aa76f75703075d6b1d3a8e267f2bcc75fa564fe6f9002b4d161
|
|
BLAKE2b-256 checksum How to use checksums |
457647688cca69b3caaca1b7daa5863c74507bbf4286b6fc97d4aa701d1f2a9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|