MCPcopy
hub / github.com/wechaty/python-wechaty / ready

Method ready

src/wechaty/user/contact.py:269–293  ·  view source on GitHub ↗

Make contact ready for use which will load contact payload info. Args: force_sync: if true, it will re-fetch the data although it exist. Examples: >>> contact = Contact.load('contact-id') >>> await await contact.ready() Raises:

(self, force_sync: bool = False)

Source from the content-addressed store, hash-verified

267 return contacts
268
269 async def ready(self, force_sync: bool = False) -> None:
270 """
271 Make contact ready for use which will load contact payload info.
272
273 Args:
274 force_sync: if true, it will re-fetch the data although it exist.
275
276 Examples:
277 >>> contact = Contact.load('contact-id')
278 >>> await await contact.ready()
279
280 Raises:
281 WechatyPayloadError: when payload can"t be loaded
282 """
283 if force_sync or not self.is_ready():
284 try:
285 self.payload = await self.puppet.contact_payload(
286 self.contact_id)
287 log.info('load contact <%s>', self)
288 except IOError as e:
289 log.info('can"t load contact %s payload, message : %s',
290 self.name,
291 str(e.args))
292
293 raise WechatyPayloadError('can"t load contact payload')
294
295 def __str__(self) -> str:
296 """

Callers 4

sayMethod · 0.95
aliasMethod · 0.95
syncMethod · 0.95
find_allMethod · 0.45

Calls 3

WechatyPayloadErrorClass · 0.90
is_readyMethod · 0.80
contact_payloadMethod · 0.80

Tested by

no test coverage detected