Skip to content

Commit 3c61d0a

Browse files
committed
update some documentation
1 parent 49e2806 commit 3c61d0a

File tree

4 files changed

+88
-3
lines changed

4 files changed

+88
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ python-syncthing
22
================
33

44
[![pypi](https://img.shields.io/pypi/v/syncthing.svg?style=flat)](https://pypi.python.org/pypi/syncthing)
5-
[![Syncthing](https://img.shields.io/badge/syncthing-0.14.44-blue.svg?style=flat)](https://syncthing.net)
5+
[![Syncthing](https://img.shields.io/badge/syncthing-1.22.0-blue.svg?style=flat)](https://syncthing.net)
66
[![Documentation Status](https://readthedocs.org/projects/python-syncthing/badge/?version=latest)](http://python-syncthing.readthedocs.io/en/latest/?badge=latest)
77
[![MIT License](https://img.shields.io/github/license/blakev/python-syncthing.svg?style=flat)](https://github.com/blakev/python-syncthing/blob/master/LICENSE)
88

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
setup(
77
name = 'syncthing',
8-
version = '2.4.3',
8+
version = '2.5.0',
99
author = 'Blake VandeMerwe',
1010
author_email = '[email protected]',
11-
description = 'Python bindings to the Syncthing REST interface, targeting v0.14.44',
11+
description = 'Python bindings to the Syncthing REST interface, targeting v1.22.0',
1212
url = 'https://github.com/blakev/python-syncthing',
1313
license = 'The MIT License',
1414
install_requires = [

syncthing/__init__.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,105 +604,189 @@ class Config(BaseAPI):
604604
prefix = '/rest/config/'
605605

606606
def config(self):
607+
""" Returns the full config
608+
"""
607609
return self.get('')
608610

609611
def put_config(self, config):
612+
""" Replaces the entire object
613+
"""
610614
return self.put('', data=config)
611615

612616
def restart_required(self):
617+
""" Returns whether a restart of Syncthing is required for the current config to take effect
618+
"""
613619
return self.get('restart-required')
614620

615621
def folders(self, id=None):
622+
""" Returns all folders. Optionally supply an ID to return the folder matching that ID
623+
"""
616624
if(id):
617625
return self.get('folders/' + id)
618626
else:
619627
return self.get('folders')
620628

621629
def put_folders(self, config, id=None):
630+
""" Replaces the entire object
631+
"""
622632
if(id):
623633
return self.put('folders/' + id, data=config)
624634
else:
625635
return self.put('folders', data=config)
626636

627637
def post_folders(self, config):
638+
""" Add a single folder
639+
"""
628640
return self.post('folders', data=config)
629641

630642
def patch_folders(self, config, id):
643+
""" Replaces only the given child objects
644+
"""
631645
return self.patch('folders/' + id, data=config)
632646

633647
def delete_folders(self, id):
648+
""" Delete a single folder matching the given ID
649+
"""
634650
return self.delete('folders/' + id)
635651

636652
def devices(self, id=None):
653+
""" Returns all devices. Optionally specificy an ID to return a single object
654+
"""
637655
if(id):
638656
return self.get('devices/' + id)
639657
else:
640658
return self.get('devices')
641659

642660
def put_devices(self, config, id=None):
661+
""" Replaces the entire object
662+
"""
643663
if(id):
644664
return self.put('devices/' + id, data=config)
645665
else:
646666
return self.put('devices', data=config)
647667

648668
def post_devices(self, config):
669+
""" Add a single devices
670+
"""
649671
return self.post('devices', data=config)
650672

651673
def patch_devices(self, config, id):
674+
""" Replaces only the given child objects
675+
"""
652676
return self.patch('devices/' + id, data=config)
653677

654678
def delete_devices(self, id):
679+
""" Delete a device with a given ID
680+
"""
655681
return self.delete('devices/' + id)
656682

657683
def defaults_folder(self):
684+
""" Get default folder object
685+
686+
Returns:
687+
dict
688+
"""
658689
return self.get('defaults/folder')
659690

660691
def put_defaults_folder(self, config):
692+
""" Replaces the entire object
693+
"""
661694
return self.put('defaults/folder', data=config)
662695

663696
def patch_defaults_folder(self, config):
697+
""" Replaces only the given child objects
698+
"""
664699
return self.patch('defaults/folder', data=config)
665700

666701
def defaults_device(self):
702+
""" Get default device object
703+
704+
Returns:
705+
dict
706+
"""
667707
return self.get('defaults/device')
668708

669709
def put_defaults_device(self, config):
710+
""" Replaces the entire object
711+
"""
670712
return self.put('defaults/device', data=config)
671713

672714
def patch_defaults_device(self, config):
715+
""" Replaces only the given child objects
716+
"""
673717
return self.patch('defaults/device', data=config)
674718

675719
def defaults_ignores(self):
720+
""" Get default ignores object
721+
722+
Returns:
723+
dict
724+
"""
676725
return self.get('defaults/ignores')
677726

678727
def put_defaults_ignores(self, config):
728+
""" Replaces the entire object
729+
"""
679730
return self.put('defaults/ignores', data=config)
680731

681732
def options(self):
733+
""" Get default options object
734+
735+
Returns:
736+
dict
737+
"""
682738
return self.get('options')
683739

684740
def put_options(self, config):
741+
""" Replaces the entire object
742+
"""
685743
return self.put('options', data=config)
686744

687745
def patch_options(self, config):
746+
""" Replaces only the given child objects
747+
"""
688748
return self.patch('options', data=config)
689749

690750
def ldap(self):
751+
""" Returns the LDAP object
752+
753+
Returns:
754+
dict
755+
"""
691756
return self.get('ldap')
692757

693758
def put_ldap(self, config):
759+
""" Replaces the entire object
760+
"""
694761
return self.put('ldap', data=config)
695762

696763
def patch_ldap(self, config):
764+
""" Replaces only the given child objects
765+
"""
697766
return self.patch('ldap', data=config)
698767

699768
def gui(self):
769+
""" Returns the GUI object
770+
771+
Returns:
772+
dict
773+
"""
700774
return self.get('gui')
701775

702776
def put_gui(self, config):
777+
""" Replaces the entire object
778+
"""
703779
return self.put('gui', data=config)
704780

705781
def patch_gui(self, config):
782+
""" Replaces only the given child objects
783+
>>> s = _syncthing().config
784+
>>> s.patch_gui({'address': '0.0.0.0:8384'})
785+
''
786+
>>> gui = s.gui()
787+
>>> '0.0.0.0' in gui['address']
788+
True
789+
"""
706790
return self.patch('gui', data=config)
707791

708792
class Cluster(BaseAPI):

tests/test_syncthing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def test_c_attributes(self):
4747
s = Syncthing('')
4848
assert s.host is not None
4949
assert hasattr(s, 'system')
50+
assert hasattr(s, 'config')
5051
assert hasattr(s, 'database')
5152
assert hasattr(s, 'stats')
5253
assert hasattr(s, 'misc')

0 commit comments

Comments
 (0)