MCPcopy Index your code
hub / github.com/O365/python-o365 / update

Method update

O365/planner.py:542–573  ·  view source on GitHub ↗

Updates this bucket :param kwargs: all the properties to be updated. :return: Success / Failure :rtype: bool

(self, **kwargs)

Source from the content-addressed store, hash-verified

540 **{self._cloud_data_key: task})
541
542 def update(self, **kwargs):
543 """ Updates this bucket
544
545 :param kwargs: all the properties to be updated.
546 :return: Success / Failure
547 :rtype: bool
548 """
549 if not self.object_id:
550 return False
551
552 url = self.build_url(
553 self._endpoints.get('bucket').format(id=self.object_id))
554
555 data = {self._cc(key): value for key, value in kwargs.items() if
556 key in ('name', 'order_hint')}
557 if not data:
558 return False
559
560 response = self.con.patch(url, data=data, headers={'If-Match': self._etag, 'Prefer': 'return=representation'})
561 if not response:
562 return False
563
564 new_data = response.json()
565
566 for key in data:
567 value = new_data.get(key, None)
568 if value is not None:
569 setattr(self, self.protocol.to_api_case(key), value)
570
571 self._etag = new_data.get('@odata.etag')
572
573 return True
574
575 def delete(self):
576 """ Deletes this bucket

Callers

nothing calls this directly

Calls 6

build_urlMethod · 0.80
_ccMethod · 0.80
jsonMethod · 0.80
to_api_caseMethod · 0.80
getMethod · 0.45
patchMethod · 0.45

Tested by

no test coverage detected