Skip to content

Commit

Permalink
Merge pull request #28 from tynanford/master
Browse files Browse the repository at this point in the history
Add method to batch update channels
  • Loading branch information
shroffk authored Sep 11, 2023
2 parents 9689d5b + 82fdf96 commit e03429f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@

*.pyc
*.pyc
build/
*.egg-info/
14 changes: 14 additions & 0 deletions channelfinder/ChannelFinderClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ def update(self, **kwds):
# updates the channel 'existingCh' with the new provided properties and tags
# without affecting the other tags and properties of this channel
update(channels = channels)
>>> update(channels=[{'name':'existingCh','owner':'chOwner', 'tags':[...], 'properties':[...]}, {...}])
# updates the channels in batch given with the new provided properties and tags
# without affecting the other tags and properties of this channel
update(property = Property, channelName = String)
>>> update(property={'name':'propName', 'owner':'propOwner', 'value':'propValue'},
channelName='ch1')
Expand Down Expand Up @@ -585,6 +590,7 @@ def __handleSingleUpdateParameter(self, **kwds):
Handle single update. It accepts key-value pair as parameters.
The keys could be one of the following:
- channel
- channels
- property
- tag
- tags
Expand All @@ -599,6 +605,14 @@ def __handleSingleUpdateParameter(self, **kwds):
verify=False,
auth=self.__auth)
r.raise_for_status()
elif 'channels' in kwds:
chs = kwds['channels']
r = self.__session.post(self.__baseURL + self.__channelsResource,
data=JSONEncoder().encode(chs),
headers=copy(self.__jsonheader),
verify=False,
auth=self.__auth)
r.raise_for_status()
elif 'property' in kwds:
property = kwds['property']
r = self.__session.post(self.__baseURL + self.__propertiesResource + '/' + property[u'name'],
Expand Down

0 comments on commit e03429f

Please sign in to comment.