Skip to content

Commit e03429f

Browse files
authored
Merge pull request #28 from tynanford/master
Add method to batch update channels
2 parents 9689d5b + 82fdf96 commit e03429f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11

2-
*.pyc
2+
*.pyc
3+
build/
4+
*.egg-info/

channelfinder/ChannelFinderClient.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,11 @@ def update(self, **kwds):
529529
# updates the channel 'existingCh' with the new provided properties and tags
530530
# without affecting the other tags and properties of this channel
531531
532+
update(channels = channels)
533+
>>> update(channels=[{'name':'existingCh','owner':'chOwner', 'tags':[...], 'properties':[...]}, {...}])
534+
# updates the channels in batch given with the new provided properties and tags
535+
# without affecting the other tags and properties of this channel
536+
532537
update(property = Property, channelName = String)
533538
>>> update(property={'name':'propName', 'owner':'propOwner', 'value':'propValue'},
534539
channelName='ch1')
@@ -585,6 +590,7 @@ def __handleSingleUpdateParameter(self, **kwds):
585590
Handle single update. It accepts key-value pair as parameters.
586591
The keys could be one of the following:
587592
- channel
593+
- channels
588594
- property
589595
- tag
590596
- tags
@@ -599,6 +605,14 @@ def __handleSingleUpdateParameter(self, **kwds):
599605
verify=False,
600606
auth=self.__auth)
601607
r.raise_for_status()
608+
elif 'channels' in kwds:
609+
chs = kwds['channels']
610+
r = self.__session.post(self.__baseURL + self.__channelsResource,
611+
data=JSONEncoder().encode(chs),
612+
headers=copy(self.__jsonheader),
613+
verify=False,
614+
auth=self.__auth)
615+
r.raise_for_status()
602616
elif 'property' in kwds:
603617
property = kwds['property']
604618
r = self.__session.post(self.__baseURL + self.__propertiesResource + '/' + property[u'name'],

0 commit comments

Comments
 (0)