{"id":50947255,"url":"https://github.com/ksachdeva/ditto-client","last_synced_at":"2026-06-17T21:31:21.895Z","repository":{"id":316260394,"uuid":"1062103244","full_name":"ksachdeva/ditto-client","owner":"ksachdeva","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-24T19:55:51.000Z","size":326,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-05T21:05:31.296Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksachdeva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-22T20:10:15.000Z","updated_at":"2026-05-24T19:35:06.000Z","dependencies_parsed_at":"2025-09-23T16:30:02.594Z","dependency_job_id":null,"html_url":"https://github.com/ksachdeva/ditto-client","commit_stats":null,"previous_names":["ksachdeva/ditto-client"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ksachdeva/ditto-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fditto-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fditto-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fditto-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fditto-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksachdeva","download_url":"https://codeload.github.com/ksachdeva/ditto-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksachdeva%2Fditto-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34466928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-17T21:31:21.241Z","updated_at":"2026-06-17T21:31:21.885Z","avatar_url":"https://github.com/ksachdeva.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eclipse Ditto Client\n\nEclipse Ditto Project - https://eclipse.dev/ditto/index.html\n\nThis repository is the python client generated using Microsoft Kiota ([https://github.com/microsoft/kiota-python](https://github.com/microsoft/kiota-python)) and a CLI based client.\n\n## Install\n\n```bash\nuv add ditto-client\n```\n\n## Running Ditto\n\nThere are 3 modes in which you can run Eclipse Ditto from this repository\n\n### Mode 1\n\nA docker compose that has `nginx` as a reverse proxy and configured to do Basic Authentication.\n\n```bash\n# to start nginx reverse proxy based setup (that uses Basic Authentication)\nuv run poe compose-ba-up\n```\n\n```bash\n# to stop nginx reverse proxy based setup\nuv run poe compose-ba-down\n```\n\n### Mode 2\n\nA docker compose that exposes the Eclipse Ditto Gateway at port 8081 and sets ENABLE_PRE_AUTHENTICATION=true\n\nIn this mode, the client application directly talks to the gateway and sets the header\n\n```bash\n# to start with out nginx and pre-auth setup\nuv run poe compose-pre-up\n```\n\n```bash\n# to stop\nuv run poe compose-pre-down\n```\n\n### Mode 3\n\nA docker compose that exposes the Eclipse Ditto Gateway at port 8081 and sets ENABLE_PRE_AUTHENTICATION=false\nand requires JWT based authentication\n\nIn this mode, the client application first gets the JWT token from the issuer and then pass it to the gateway\n\n\u003e Look at assets/ditto/ditto-gateway-jwt.yml to learn about the settings (A mock oauth server is included)\n\n```bash\n# to start with out nginx and pre-auth setup\nuv run poe compose-jwt-up\n```\n\n```bash\n# to stop\nuv run poe compose-jwt-down\n```\n\n## Usage - API\n\n***Basic Authentication***\n\n```python\nauth_provider = BasicAuthProvider(user_name=_USERNAME, password=_PASSWORD)\n\nrequest_adapter = HttpxRequestAdapter(auth_provider)\nrequest_adapter.base_url = \"http://host.docker.internal:8080\"\n\nditto_client = DittoClient(request_adapter)\n\nresponse = await ditto_client.api.two.things.get()\n```\n\nDefault setup for Ditto uses Ngix with basic authentication. A custom authentication provider has been included\nin the library to support it. See [BasicAuth Provider](src/ditto_client/basic_auth.py).\n\n[See examples/basic.py for the full usage](examples/basic.py)\n\n***Pre Authentication***\n\n```python\nauth_provider = PreAuthProvider(auth_subject=\"ditto:ditto\")\n\nrequest_adapter = HttpxRequestAdapter(auth_provider)\n# Note the port is that of gateway\nrequest_adapter.base_url = \"http://host.docker.internal:8081\"\n\nditto_client = DittoClient(request_adapter)\n\nresponse = await ditto_client.api.two.things.get()\n```\n\nA custom authentication provider has been included. See [PreAuth Provider](src/ditto_client/pre.py).\n\n[See examples/pre.py for the full usage](examples/pre.py)\n\n\n**JWT Authentication**\n\n```python\nauth_provider = JWTAuthProvider(token=\u003cyour_token\u003e\")\n\nrequest_adapter = HttpxRequestAdapter(auth_provider)\n# Note the port is that of gateway\nrequest_adapter.base_url = \"http://host.docker.internal:8081\"\n\nditto_client = DittoClient(request_adapter)\n\nresponse = await ditto_client.api.two.things.get()\n```\n\nA custom authentication provider has been included. See [JWTAuth Provider](src/ditto_client/jwt.py).\n\n[See examples/jwt.py for the full usage](examples/jwt.py)\n\n\n## Usage - CLI\n\nThe Ditto client includes a comprehensive CLI for interacting with Eclipse Ditto services. The CLI provides the following commands:\n\n```markdown\n Usage: ditto-client [OPTIONS] COMMAND [ARGS]...\n\n╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮\n│ --loglevel            -l      TEXT                  Set the logging level (debug, info, warning, error, critical) [default: warning]                                        │\n│ --base-url                    TEXT                  Base URL for the Ditto API (can also be set via DITTO_BASE_URL environment variable) [env var: DITTO_BASE_URL]          │\n│                                                     [default: http://host.docker.internal:8080]                                                                             │\n│ --auth-type                   [basic|pre-auth|jwt]  Set the authentication type (basic, pre-auth) [default: basic]                                                          │\n│ --username                    TEXT                  Username for basic authentication (can also be set via DITTO_USERNAME environment variable) [env var: DITTO_USERNAME]   │\n│ --password                    TEXT                  Password for basic authentication (can also be set via DITTO_PASSWORD environment variable) [env var: DITTO_PASSWORD]   │\n│ --preauth-subject             TEXT                  Auth subject for pre-authentication (can also be set via DITTO_PREAUTH_SUBJECT environment variable)                    │\n│                                                     [env var: DITTO_PREAUTH_SUBJECT]                                                                                        │\n│ --jwt-token                   TEXT                  JWT token for authentication (can also be set via DITTO_JWT_TOKEN environment variable) [env var: DITTO_JWT_TOKEN]      │\n│ --table                                             Output results as a rich table instead of JSON                                                                          │\n│ --install-completion                                Install completion for the current shell.                                                                               │\n│ --show-completion                                   Show completion for the current shell, to copy it or customize the installation.                                        │\n│ --help                                              Show this message and exit.                                                                                             │\n╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮\n│ whoami       Get current user information.                                                                                                                                  │\n│ policy       Policy management                                                                                                                                              │\n│ thing        Thing management                                                                                                                                               │\n│ search       Thing search                                                                                                                                                   │\n│ permission   Permission check                                                                                                                                               │\n│ devops       DevOps                                                                                                                                                         │\n╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n```\n\n### Global Configuration\n\nYou can pass various secrets on the command line and/or use the `.env` file.\n\nSee `.env.example` for the entries\n\n---\n\n### Policy Management\n\n#### Create a new policy.\n\n```bash\n# Create a new policy\nditto-client policy create \"my.sensors:sensor-policy\" examples/cli-examples/policy.json\n```\n\n#### Retrieve a specific policy by ID.\n\n```bash\n# Get a policy\nditto-client policy get \"my.sensors:sensor-policy\"\n```\n\n#### List policy entries.\n\n```bash\n# List all policy entries\nditto-client policy entries \"my.sensors:sensor-policy\"\n```\n\n#### Delete policy.\n\n```bash\n# Delete a policy\nditto-client policy delete \"my.sensors:sensor-policy\"\n```\n\n---\n\n### Things Management\n\n#### Create a new thing.\n\n```bash\n# Make sure to create the policy (my.sensors:sensor-policy) See above example\n# Create a new thing\nditto-client thing create \"my.sensors:sensor-001\" examples/cli-examples/thing-humidity.json\n```\n\n#### List all things with optional filtering.\n\n```bash\n# List all things\nditto-client thing list\n\n# List things with specific fields\nditto-client thing list --fields \"thingId,attributes\"\n\n# List specific things by ID\nditto-client thing list --ids \"my.sensors:sensor-001\"\n```\n\n#### Retrieve a specific thing by ID.\n\n```bash\n# Get a specific thing\nditto-client thing get \"my.sensors:sensor-001\"\n\n# Get a specific revision of a thing\nditto-client thing get \"my.sensors:sensor-001\" --revision 1\n```\n\n#### Update a thing using JSON file.\n\n```bash\n# Update a thing\nditto-client thing update \"my.sensors:sensor-001\" examples/cli-examples/thing-humidity.json\n```\n\n#### Compare current thing with historical revision.\n\n```bash\n# Compare current state with revision 1\nditto-client thing diff \"my.sensors:sensor-001\" 1\n```\n\n#### Delete a thing.\n\n```bash\n# Delete a thing\nditto-client thing delete \"my.sensors:sensor-001\"\n```\n\n---\n\n### Search Operations\n\nRefer below documentation to understand RQL syntax:\nhttps://eclipse.dev/ditto/1.5/basic-rql.html\n\n#### Search for things using RQL (Resource Query Language).\n\n```bash\n# Search all things\nditto-client search query\n\n# Search with filter\nditto-client search query --filter 'eq(attributes/location,\"Kitchen\")'\n\n# Search with size limit and sorting\nditto-client search query --option \"size(3),sort(+thingId)\"\n\n# Search in specific namespaces\nditto-client search query --namespaces \"my.sensors\"\n```\n\n#### Count things matching search criteria.\n\n```bash\n# Count all things\nditto-client search count\n\n# Count things with filter\nditto-client search count --filter 'eq(attributes/location,\"Kitchen\")'\n```\n\n---\n\n### Connection Management (DevOps)\n\n#### Create a new connection.\n\n```bash\n# Create a connection\nditto-client devops connection create \"new-connection\" examples/cli-examples/connection.json\n```\n\n#### List all connections.\n\n```bash\n# List all connections\nditto-client devops connection list\n\n# List with specific fields\nditto-client devops connection list --fields \"id,connectionStatus\"\n```\n\n#### Retrieve a specific connection by ID.\n\n```bash\n# Get a connection\nditto-client devops connection get \"new-connection\"\n\n# Get with specific fields\nditto-client devops connection get \"new-connection\" --fields \"id,status\"\n```\n\n#### Delete a connection.\n\n```bash\n# Delete a connection\nditto-client devops connection delete \"new-connection\"\n```\n\n---\n\n### Configuration Management (DevOps)\n\n#### Retrieve service configuration.\n\n```bash\n# Get all configuration\nditto-client devops config get\n```\n\n---\n\n### Logging Management (DevOps)\n\n#### Retrieve logging configuration.\n\n```bash\n# Get logging configuration\nditto-client devops logging get\n\n# Get module-specific config\nditto-client devops logging get --module-name \"gateway\"\n```\n\n#### Update logging configuration.\n\n```bash\n# Update logging configuration\nditto-client devops logging update examples/cli-examples/logging.json\n```\n\n---\n\n### Permission Management (DevOps)\n\n#### Check permissions on specified resources.\n\n```bash\n# Check permissions\nditto-client permission check examples/cli-examples/permission.json\n```\n\n---\n\n\n#### Get current user information.\n\n```bash\n# Get current user info\nditto-client whoami\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksachdeva%2Fditto-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksachdeva%2Fditto-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksachdeva%2Fditto-client/lists"}