pywxclient.utils module

Utility module.

class pywxclient.utils.ParseWxRes

Bases: object

Parse WeChat API response.

classmethod exec_js(js_code, js_locals=None)

Execute javascript code in Python.

classmethod parse_login(res_js)

Parse login javascript response.

classmethod parse_new_login_page(res_xml)

Parse new login page xml response.

classmethod parse_qrcode_uuid(res_js)

Parse qrcode uuid javascript response.

classmethod parse_sync_check(res_js)

Parse sync check javascript response.

pywxclient.utils.cookie_to_dict(cookie)

Return cookie attributes as dict.

class pywxclient.utils.MessageType

Bases: type

Message meta type.

pywxclient.utils.json_dumps(json_data, compact=False, **kwargs)

Dump dict to json string.

pywxclient.utils.xml2dict(xml_str)

Convert xml document to dict.

pywxclient.utils.dict2xml(data)

Convert dict to xml document.

pywxclient.utils.call_retry(retry_exceptions, retries=3)

Auto retry when exception occurs.

Parameters:
  • retry_exceptions – catch exception tuple.
  • retries – retry times.
pywxclient.utils.list2orderdict(key_list, val_list)

Return a ordered dict with two lists.