Skip to main content

Python bindings to the Syncthing REST interface, targeting v0.12.8

Project description

# python-syncthing

[![downloads/month](https://img.shields.io/pypi/dm/syncthing.svg?style=flat)](https://pypi.python.org/pypi/syncthing)
![version 1.0.0](https://img.shields.io/badge/version-1.0.0-orange.svg)

Python bindings to the Syncthing REST interface.

- [Syncthing](https://syncthing.net/)
- [Syncthing REST Documentation](http://docs.syncthing.net/dev/rest.html)
- [Syncthing Forums](https://forum.syncthing.net/)

### Installation

```bash
pip install syncthing
```

The main interface `Syncthing` provides access to all of the underlying endpoints. They're divided the same as the documentation, in categories: `sys` (`system`), `db` (`database`), `stats`, `misc`. All `GET` methods are available as immediate function calls, and `POST` methods via **`sync.CATEGORY.set.COMMAND()`** (for example, `sync.sys.set.config(..)`).

### Usage

```python
from syncthing import Syncthing

sync = Syncthing(api_key='xxxxabcdef', port=8384)

print(sync.sys.config())
```

#### Deferred Instantiation

```python

sync = Syncthing()
...
...
sync.init(api_key='...')
```

#### Instance Values

Both the `syncthing.Syncthing` and `syncthing.Interface` objects take the same `__init__` parameters. `Syncthing` provides getter/setter methods for the REST api that direct all communication through the `Interface` instance. An `Interface` object could interact with Syncthing directly by passing endpoints to the `do_req` method.

- `api_key`: **required**
- `host`: *localhost*
- `port`: *8080*
- `timeout`: *3.5* (seconds)
- `is_https`: *False*
- `ssl_cert_file`: *None*


#### GET Methods

```python
conf = sync.sys.config()
logs = sync.sys.log()
db_status = sync.db.status()
```

#### POST Methods

```python
sync.sys.set.restart()
sync.db.set.scan(folder='desktop_home')
```

### License

> The MIT License (MIT)
>
> Copyright (c) 2015-2016 Blake VandeMerwe
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

syncthing-1.0.0.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file syncthing-1.0.0.tar.gz.

File metadata

  • Download URL: syncthing-1.0.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for syncthing-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d796aebc6ed8c3d1245ef0c41e7689d7092971c3c15e3dabf83fbc367171f365
MD5 22f48f2a99f2cdc54c9fb06af093fa70
BLAKE2b-256 8bb2d93b01475d8943527fbe094ebb6f2abf2c7c85cc7bc6a3cd1154b99944f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page