partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | configure_logging | Set up log levels, and split verbose logs to a file
Configure the client-side environment logs to print
to stdout at "info" level, and also to print to a
verbose log file located at /tmp/universe-<pid>.log
or another path you specify at "debug" level.
We suggest calling this met... | universe/__init__.py | def configure_logging(path=None):
"""
Set up log levels, and split verbose logs to a file
Configure the client-side environment logs to print
to stdout at "info" level, and also to print to a
verbose log file located at /tmp/universe-<pid>.log
or another path you specify at "deb... | def configure_logging(path=None):
"""
Set up log levels, and split verbose logs to a file
Configure the client-side environment logs to print
to stdout at "info" level, and also to print to a
verbose log file located at /tmp/universe-<pid>.log
or another path you specify at "deb... | [
"Set",
"up",
"log",
"levels",
"and",
"split",
"verbose",
"logs",
"to",
"a",
"file"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/__init__.py#L48-L86 | [
"def",
"configure_logging",
"(",
"path",
"=",
"None",
")",
":",
"global",
"_logging_configured",
"if",
"_logging_configured",
":",
"return",
"_logging_configured",
"=",
"True",
"if",
"path",
"is",
"False",
":",
"# Disable logfile",
"return",
"elif",
"path",
"is",
... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | get_client | Set DOCKER_HOST (and probably DOCKER_TLS_VERIFY and DOCKER_CERT_PATH) to connect to a docker instance through TCP.
Leave DOCKER_HOST unset and it will use the default, typically unix:/var/run/docker.sock
It also needs to know how to connect to ports on the docker container after creating it.
Set DOCKER_NET... | universe/remotes/docker_remote.py | def get_client():
"""
Set DOCKER_HOST (and probably DOCKER_TLS_VERIFY and DOCKER_CERT_PATH) to connect to a docker instance through TCP.
Leave DOCKER_HOST unset and it will use the default, typically unix:/var/run/docker.sock
It also needs to know how to connect to ports on the docker container after c... | def get_client():
"""
Set DOCKER_HOST (and probably DOCKER_TLS_VERIFY and DOCKER_CERT_PATH) to connect to a docker instance through TCP.
Leave DOCKER_HOST unset and it will use the default, typically unix:/var/run/docker.sock
It also needs to know how to connect to ports on the docker container after c... | [
"Set",
"DOCKER_HOST",
"(",
"and",
"probably",
"DOCKER_TLS_VERIFY",
"and",
"DOCKER_CERT_PATH",
")",
"to",
"connect",
"to",
"a",
"docker",
"instance",
"through",
"TCP",
".",
"Leave",
"DOCKER_HOST",
"unset",
"and",
"it",
"will",
"use",
"the",
"default",
"typically"... | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/remotes/docker_remote.py#L113-L157 | [
"def",
"get_client",
"(",
")",
":",
"info",
"=",
"{",
"}",
"host",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'DOCKER_HOST'",
")",
"net_host",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'DOCKER_NET_HOST'",
")",
"client_api_version",
"=",
"os",
".",... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | DockerManager.pop | Call from main thread. Returns the list of newly-available (handle, env) pairs. | universe/remotes/docker_remote.py | def pop(self, n=None):
"""Call from main thread. Returns the list of newly-available (handle, env) pairs."""
if self._popped:
assert n is None
return []
self._popped = True
envs = []
for i, instance in enumerate(self.instances):
env = remote.R... | def pop(self, n=None):
"""Call from main thread. Returns the list of newly-available (handle, env) pairs."""
if self._popped:
assert n is None
return []
self._popped = True
envs = []
for i, instance in enumerate(self.instances):
env = remote.R... | [
"Call",
"from",
"main",
"thread",
".",
"Returns",
"the",
"list",
"of",
"newly",
"-",
"available",
"(",
"handle",
"env",
")",
"pairs",
"."
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/remotes/docker_remote.py#L60-L77 | [
"def",
"pop",
"(",
"self",
",",
"n",
"=",
"None",
")",
":",
"if",
"self",
".",
"_popped",
":",
"assert",
"n",
"is",
"None",
"return",
"[",
"]",
"self",
".",
"_popped",
"=",
"True",
"envs",
"=",
"[",
"]",
"for",
"i",
",",
"instance",
"in",
"enum... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | Recording._get_writer | Returns a tuple of (log_fn, log_f, bin_fn, bin_f) to be written to by vectorized env channel i
Or all Nones if recording is inactive on that channel | universe/wrappers/recording.py | def _get_writer(self, i):
"""
Returns a tuple of (log_fn, log_f, bin_fn, bin_f) to be written to by vectorized env channel i
Or all Nones if recording is inactive on that channel
"""
if self._recording_dir is None:
return None
if self._log_n is None:
... | def _get_writer(self, i):
"""
Returns a tuple of (log_fn, log_f, bin_fn, bin_f) to be written to by vectorized env channel i
Or all Nones if recording is inactive on that channel
"""
if self._recording_dir is None:
return None
if self._log_n is None:
... | [
"Returns",
"a",
"tuple",
"of",
"(",
"log_fn",
"log_f",
"bin_fn",
"bin_f",
")",
"to",
"be",
"written",
"to",
"by",
"vectorized",
"env",
"channel",
"i",
"Or",
"all",
"Nones",
"if",
"recording",
"is",
"inactive",
"on",
"that",
"channel"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/wrappers/recording.py#L77-L88 | [
"def",
"_get_writer",
"(",
"self",
",",
"i",
")",
":",
"if",
"self",
".",
"_recording_dir",
"is",
"None",
":",
"return",
"None",
"if",
"self",
".",
"_log_n",
"is",
"None",
":",
"self",
".",
"_log_n",
"=",
"[",
"None",
"]",
"*",
"self",
".",
"n",
... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | UniverseTimeLimit._past_limit | Return true if we are past our limit | universe/wrappers/time_limit.py | def _past_limit(self):
"""Return true if we are past our limit"""
if self._max_episode_steps is not None and self._max_episode_steps <= self._elapsed_steps:
logger.debug("Env has passed the step limit defined by TimeLimit.")
return True
if self._max_episode_seconds is no... | def _past_limit(self):
"""Return true if we are past our limit"""
if self._max_episode_steps is not None and self._max_episode_steps <= self._elapsed_steps:
logger.debug("Env has passed the step limit defined by TimeLimit.")
return True
if self._max_episode_seconds is no... | [
"Return",
"true",
"if",
"we",
"are",
"past",
"our",
"limit"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/wrappers/time_limit.py#L27-L37 | [
"def",
"_past_limit",
"(",
"self",
")",
":",
"if",
"self",
".",
"_max_episode_steps",
"is",
"not",
"None",
"and",
"self",
".",
"_max_episode_steps",
"<=",
"self",
".",
"_elapsed_steps",
":",
"logger",
".",
"debug",
"(",
"\"Env has passed the step limit defined by ... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | VNCProxyServer.recvProxyData | Write data to server | universe/vncdriver/vnc_proxy_server.py | def recvProxyData(self, data):
"""Write data to server"""
if self.initialized:
self.sendData(data)
else:
self.queued_data.append(data) | def recvProxyData(self, data):
"""Write data to server"""
if self.initialized:
self.sendData(data)
else:
self.queued_data.append(data) | [
"Write",
"data",
"to",
"server"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vnc_proxy_server.py#L418-L423 | [
"def",
"recvProxyData",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"initialized",
":",
"self",
".",
"sendData",
"(",
"data",
")",
"else",
":",
"self",
".",
"queued_data",
".",
"append",
"(",
"data",
")"
] | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | VNCProxyClient.sendData | Write data to server | universe/vncdriver/vnc_proxy_server.py | def sendData(self, data):
"""Write data to server"""
# Not set up yet
if self.client_log is None:
self.client_log_buffer.append(data)
else:
self.client_log.write(data)
self.transport.write(data) | def sendData(self, data):
"""Write data to server"""
# Not set up yet
if self.client_log is None:
self.client_log_buffer.append(data)
else:
self.client_log.write(data)
self.transport.write(data) | [
"Write",
"data",
"to",
"server"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vnc_proxy_server.py#L485-L492 | [
"def",
"sendData",
"(",
"self",
",",
"data",
")",
":",
"# Not set up yet",
"if",
"self",
".",
"client_log",
"is",
"None",
":",
"self",
".",
"client_log_buffer",
".",
"append",
"(",
"data",
")",
"else",
":",
"self",
".",
"client_log",
".",
"write",
"(",
... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | CropObservations | Crops the visual observations of an environment so that they only contain the game screen.
Removes anything outside the game that usually belongs to universe (browser borders and so on). | universe/wrappers/experimental/observation.py | def CropObservations(env):
""""
Crops the visual observations of an environment so that they only contain the game screen.
Removes anything outside the game that usually belongs to universe (browser borders and so on).
"""
if env.spec.tags.get('flashgames', False):
spec = runtime_spec('flash... | def CropObservations(env):
""""
Crops the visual observations of an environment so that they only contain the game screen.
Removes anything outside the game that usually belongs to universe (browser borders and so on).
"""
if env.spec.tags.get('flashgames', False):
spec = runtime_spec('flash... | [
"Crops",
"the",
"visual",
"observations",
"of",
"an",
"environment",
"so",
"that",
"they",
"only",
"contain",
"the",
"game",
"screen",
".",
"Removes",
"anything",
"outside",
"the",
"game",
"that",
"usually",
"belongs",
"to",
"universe",
"(",
"browser",
"border... | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/wrappers/experimental/observation.py#L9-L21 | [
"def",
"CropObservations",
"(",
"env",
")",
":",
"if",
"env",
".",
"spec",
".",
"tags",
".",
"get",
"(",
"'flashgames'",
",",
"False",
")",
":",
"spec",
"=",
"runtime_spec",
"(",
"'flashgames'",
")",
".",
"server_registry",
"[",
"env",
".",
"spec",
"."... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | AtariKeyState.apply_vnc_actions | Play a list of vnc_actions forward over the current keysyms state
NOTE: Since we are squashing a set of diffs into a single keyboard state, some information may be lost.
For example if the Z key is down, then we receive [(Z-up), (Z-down)], the output will not reflect any change in Z
You can mak... | universe/envs/vnc_core_env/translator.py | def apply_vnc_actions(self, vnc_actions):
"""
Play a list of vnc_actions forward over the current keysyms state
NOTE: Since we are squashing a set of diffs into a single keyboard state, some information may be lost.
For example if the Z key is down, then we receive [(Z-up), (Z-down)], t... | def apply_vnc_actions(self, vnc_actions):
"""
Play a list of vnc_actions forward over the current keysyms state
NOTE: Since we are squashing a set of diffs into a single keyboard state, some information may be lost.
For example if the Z key is down, then we receive [(Z-up), (Z-down)], t... | [
"Play",
"a",
"list",
"of",
"vnc_actions",
"forward",
"over",
"the",
"current",
"keysyms",
"state"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/envs/vnc_core_env/translator.py#L19-L34 | [
"def",
"apply_vnc_actions",
"(",
"self",
",",
"vnc_actions",
")",
":",
"for",
"event",
"in",
"vnc_actions",
":",
"if",
"isinstance",
"(",
"event",
",",
"spaces",
".",
"KeyEvent",
")",
":",
"if",
"event",
".",
"down",
":",
"self",
".",
"_down_keysyms",
".... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | ControlBuffer.recv_rpc | Call from any thread | universe/rewarder/remote.py | def recv_rpc(self, context, payload):
"""Call from any thread"""
logger.debug("Adding RPC payload to ControlBuffer queue: %s", payload)
self.buf.put(('rpc', (context, payload)))
with self.cv:
self.cv.notifyAll() | def recv_rpc(self, context, payload):
"""Call from any thread"""
logger.debug("Adding RPC payload to ControlBuffer queue: %s", payload)
self.buf.put(('rpc', (context, payload)))
with self.cv:
self.cv.notifyAll() | [
"Call",
"from",
"any",
"thread"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/rewarder/remote.py#L145-L150 | [
"def",
"recv_rpc",
"(",
"self",
",",
"context",
",",
"payload",
")",
":",
"logger",
".",
"debug",
"(",
"\"Adding RPC payload to ControlBuffer queue: %s\"",
",",
"payload",
")",
"self",
".",
"buf",
".",
"put",
"(",
"(",
"'rpc'",
",",
"(",
"context",
",",
"p... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | ControlBuffer.get | Call from main thread. | universe/rewarder/remote.py | def get(self, *args, **kwargs):
"""Call from main thread."""
payload = self.buf.get(*args, **kwargs)
logger.debug("Removing RPC payload from ControlBuffer queue: %s", payload)
return payload | def get(self, *args, **kwargs):
"""Call from main thread."""
payload = self.buf.get(*args, **kwargs)
logger.debug("Removing RPC payload from ControlBuffer queue: %s", payload)
return payload | [
"Call",
"from",
"main",
"thread",
"."
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/rewarder/remote.py#L155-L159 | [
"def",
"get",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"payload",
"=",
"self",
".",
"buf",
".",
"get",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"logger",
".",
"debug",
"(",
"\"Removing RPC payload from ControlBuffer queu... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | AgentConn.send_env_text | text channel to communicate with the agent | universe/rewarder/remote.py | def send_env_text(self, text, episode_id):
''' text channel to communicate with the agent '''
reactor.callFromThread(self._send_env_text, text, episode_id) | def send_env_text(self, text, episode_id):
''' text channel to communicate with the agent '''
reactor.callFromThread(self._send_env_text, text, episode_id) | [
"text",
"channel",
"to",
"communicate",
"with",
"the",
"agent"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/rewarder/remote.py#L252-L254 | [
"def",
"send_env_text",
"(",
"self",
",",
"text",
",",
"episode_id",
")",
":",
"reactor",
".",
"callFromThread",
"(",
"self",
".",
"_send_env_text",
",",
"text",
",",
"episode_id",
")"
] | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | build_log_presenters | Return an iterable of functions.
Each function can be used to format the logs output of a container. | universe/remotes/compose/log_printer.py | def build_log_presenters(service_names, monochrome):
"""Return an iterable of functions.
Each function can be used to format the logs output of a container.
"""
prefix_width = max_name_width(service_names)
def no_color(text):
return text
for color_func in cycle([no_color] if monochrom... | def build_log_presenters(service_names, monochrome):
"""Return an iterable of functions.
Each function can be used to format the logs output of a container.
"""
prefix_width = max_name_width(service_names)
def no_color(text):
return text
for color_func in cycle([no_color] if monochrom... | [
"Return",
"an",
"iterable",
"of",
"functions",
"."
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/remotes/compose/log_printer.py#L40-L51 | [
"def",
"build_log_presenters",
"(",
"service_names",
",",
"monochrome",
")",
":",
"prefix_width",
"=",
"max_name_width",
"(",
"service_names",
")",
"def",
"no_color",
"(",
"text",
")",
":",
"return",
"text",
"for",
"color_func",
"in",
"cycle",
"(",
"[",
"no_co... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | consume_queue | Consume the queue by reading lines off of it and yielding them. | universe/remotes/compose/log_printer.py | def consume_queue(queue, cascade_stop):
"""Consume the queue by reading lines off of it and yielding them."""
while True:
try:
item = queue.get(timeout=0.1)
except Empty:
yield None
continue
# See https://github.com/docker/compose/issues/189
ex... | def consume_queue(queue, cascade_stop):
"""Consume the queue by reading lines off of it and yielding them."""
while True:
try:
item = queue.get(timeout=0.1)
except Empty:
yield None
continue
# See https://github.com/docker/compose/issues/189
ex... | [
"Consume",
"the",
"queue",
"by",
"reading",
"lines",
"off",
"of",
"it",
"and",
"yielding",
"them",
"."
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/remotes/compose/log_printer.py#L217-L238 | [
"def",
"consume_queue",
"(",
"queue",
",",
"cascade_stop",
")",
":",
"while",
"True",
":",
"try",
":",
"item",
"=",
"queue",
".",
"get",
"(",
"timeout",
"=",
"0.1",
")",
"except",
"Empty",
":",
"yield",
"None",
"continue",
"# See https://github.com/docker/co... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | _baseDes.setKey | Will set the crypting key for this object. | universe/vncdriver/vendor/pydes.py | def setKey(self, key):
"""Will set the crypting key for this object."""
key = self._guardAgainstUnicode(key)
self.__key = key | def setKey(self, key):
"""Will set the crypting key for this object."""
key = self._guardAgainstUnicode(key)
self.__key = key | [
"Will",
"set",
"the",
"crypting",
"key",
"for",
"this",
"object",
"."
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L130-L133 | [
"def",
"setKey",
"(",
"self",
",",
"key",
")",
":",
"key",
"=",
"self",
".",
"_guardAgainstUnicode",
"(",
"key",
")",
"self",
".",
"__key",
"=",
"key"
] | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | _baseDes.setPadding | setPadding() -> bytes of length 1. Padding character. | universe/vncdriver/vendor/pydes.py | def setPadding(self, pad):
"""setPadding() -> bytes of length 1. Padding character."""
if pad is not None:
pad = self._guardAgainstUnicode(pad)
self._padding = pad | def setPadding(self, pad):
"""setPadding() -> bytes of length 1. Padding character."""
if pad is not None:
pad = self._guardAgainstUnicode(pad)
self._padding = pad | [
"setPadding",
"()",
"-",
">",
"bytes",
"of",
"length",
"1",
".",
"Padding",
"character",
"."
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L147-L151 | [
"def",
"setPadding",
"(",
"self",
",",
"pad",
")",
":",
"if",
"pad",
"is",
"not",
"None",
":",
"pad",
"=",
"self",
".",
"_guardAgainstUnicode",
"(",
"pad",
")",
"self",
".",
"_padding",
"=",
"pad"
] | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | _baseDes.setIV | Will set the Initial Value, used in conjunction with CBC mode | universe/vncdriver/vendor/pydes.py | def setIV(self, IV):
"""Will set the Initial Value, used in conjunction with CBC mode"""
if not IV or len(IV) != self.block_size:
raise ValueError("Invalid Initial Value (IV), must be a multiple of " + str(self.block_size) + " bytes")
IV = self._guardAgainstUnicode(IV)
self._iv = IV | def setIV(self, IV):
"""Will set the Initial Value, used in conjunction with CBC mode"""
if not IV or len(IV) != self.block_size:
raise ValueError("Invalid Initial Value (IV), must be a multiple of " + str(self.block_size) + " bytes")
IV = self._guardAgainstUnicode(IV)
self._iv = IV | [
"Will",
"set",
"the",
"Initial",
"Value",
"used",
"in",
"conjunction",
"with",
"CBC",
"mode"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L165-L170 | [
"def",
"setIV",
"(",
"self",
",",
"IV",
")",
":",
"if",
"not",
"IV",
"or",
"len",
"(",
"IV",
")",
"!=",
"self",
".",
"block_size",
":",
"raise",
"ValueError",
"(",
"\"Invalid Initial Value (IV), must be a multiple of \"",
"+",
"str",
"(",
"self",
".",
"blo... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | des.__String_to_BitList | Turn the string data, into a list of bits (1, 0)'s | universe/vncdriver/vendor/pydes.py | def __String_to_BitList(self, data):
"""Turn the string data, into a list of bits (1, 0)'s"""
if _pythonMajorVersion < 3:
# Turn the strings into integers. Python 3 uses a bytes
# class, which already has this behaviour.
data = [ord(c) for c in data]
l = len(data) * 8
result = [0] * l
pos = 0
for c... | def __String_to_BitList(self, data):
"""Turn the string data, into a list of bits (1, 0)'s"""
if _pythonMajorVersion < 3:
# Turn the strings into integers. Python 3 uses a bytes
# class, which already has this behaviour.
data = [ord(c) for c in data]
l = len(data) * 8
result = [0] * l
pos = 0
for c... | [
"Turn",
"the",
"string",
"data",
"into",
"a",
"list",
"of",
"bits",
"(",
"1",
"0",
")",
"s"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L416-L435 | [
"def",
"__String_to_BitList",
"(",
"self",
",",
"data",
")",
":",
"if",
"_pythonMajorVersion",
"<",
"3",
":",
"# Turn the strings into integers. Python 3 uses a bytes",
"# class, which already has this behaviour.",
"data",
"=",
"[",
"ord",
"(",
"c",
")",
"for",
"c",
"... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | des.__BitList_to_String | Turn the list of bits -> data, into a string | universe/vncdriver/vendor/pydes.py | def __BitList_to_String(self, data):
"""Turn the list of bits -> data, into a string"""
result = []
pos = 0
c = 0
while pos < len(data):
c += data[pos] << (7 - (pos % 8))
if (pos % 8) == 7:
result.append(c)
c = 0
pos += 1
if _pythonMajorVersion < 3:
return ''.join([ chr(c) for c in resu... | def __BitList_to_String(self, data):
"""Turn the list of bits -> data, into a string"""
result = []
pos = 0
c = 0
while pos < len(data):
c += data[pos] << (7 - (pos % 8))
if (pos % 8) == 7:
result.append(c)
c = 0
pos += 1
if _pythonMajorVersion < 3:
return ''.join([ chr(c) for c in resu... | [
"Turn",
"the",
"list",
"of",
"bits",
"-",
">",
"data",
"into",
"a",
"string"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L437-L452 | [
"def",
"__BitList_to_String",
"(",
"self",
",",
"data",
")",
":",
"result",
"=",
"[",
"]",
"pos",
"=",
"0",
"c",
"=",
"0",
"while",
"pos",
"<",
"len",
"(",
"data",
")",
":",
"c",
"+=",
"data",
"[",
"pos",
"]",
"<<",
"(",
"7",
"-",
"(",
"pos",... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | des.__permutate | Permutate this block with the specified table | universe/vncdriver/vendor/pydes.py | def __permutate(self, table, block):
"""Permutate this block with the specified table"""
return list(map(lambda x: block[x], table)) | def __permutate(self, table, block):
"""Permutate this block with the specified table"""
return list(map(lambda x: block[x], table)) | [
"Permutate",
"this",
"block",
"with",
"the",
"specified",
"table"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L454-L456 | [
"def",
"__permutate",
"(",
"self",
",",
"table",
",",
"block",
")",
":",
"return",
"list",
"(",
"map",
"(",
"lambda",
"x",
":",
"block",
"[",
"x",
"]",
",",
"table",
")",
")"
] | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | des.__create_sub_keys | Create the 16 subkeys K[1] to K[16] from the given key | universe/vncdriver/vendor/pydes.py | def __create_sub_keys(self):
"""Create the 16 subkeys K[1] to K[16] from the given key"""
key = self.__permutate(des.__pc1, self.__String_to_BitList(self.getKey()))
i = 0
# Split into Left and Right sections
self.L = key[:28]
self.R = key[28:]
while i < 16:
j = 0
# Perform circular left shifts
wh... | def __create_sub_keys(self):
"""Create the 16 subkeys K[1] to K[16] from the given key"""
key = self.__permutate(des.__pc1, self.__String_to_BitList(self.getKey()))
i = 0
# Split into Left and Right sections
self.L = key[:28]
self.R = key[28:]
while i < 16:
j = 0
# Perform circular left shifts
wh... | [
"Create",
"the",
"16",
"subkeys",
"K",
"[",
"1",
"]",
"to",
"K",
"[",
"16",
"]",
"from",
"the",
"given",
"key"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L460-L482 | [
"def",
"__create_sub_keys",
"(",
"self",
")",
":",
"key",
"=",
"self",
".",
"__permutate",
"(",
"des",
".",
"__pc1",
",",
"self",
".",
"__String_to_BitList",
"(",
"self",
".",
"getKey",
"(",
")",
")",
")",
"i",
"=",
"0",
"# Split into Left and Right sectio... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | des.encrypt | encrypt(data, [pad], [padmode]) -> bytes
data : Bytes to be encrypted
pad : Optional argument for encryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be encrypted
with the already specified key. Data does not... | universe/vncdriver/vendor/pydes.py | def encrypt(self, data, pad=None, padmode=None):
"""encrypt(data, [pad], [padmode]) -> bytes
data : Bytes to be encrypted
pad : Optional argument for encryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be enc... | def encrypt(self, data, pad=None, padmode=None):
"""encrypt(data, [pad], [padmode]) -> bytes
data : Bytes to be encrypted
pad : Optional argument for encryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be enc... | [
"encrypt",
"(",
"data",
"[",
"pad",
"]",
"[",
"padmode",
"]",
")",
"-",
">",
"bytes"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L642-L659 | [
"def",
"encrypt",
"(",
"self",
",",
"data",
",",
"pad",
"=",
"None",
",",
"padmode",
"=",
"None",
")",
":",
"data",
"=",
"self",
".",
"_guardAgainstUnicode",
"(",
"data",
")",
"if",
"pad",
"is",
"not",
"None",
":",
"pad",
"=",
"self",
".",
"_guardA... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | des.decrypt | decrypt(data, [pad], [padmode]) -> bytes
data : Bytes to be encrypted
pad : Optional argument for decryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be decrypted
with the already specified key. In PAD_NORMAL... | universe/vncdriver/vendor/pydes.py | def decrypt(self, data, pad=None, padmode=None):
"""decrypt(data, [pad], [padmode]) -> bytes
data : Bytes to be encrypted
pad : Optional argument for decryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be dec... | def decrypt(self, data, pad=None, padmode=None):
"""decrypt(data, [pad], [padmode]) -> bytes
data : Bytes to be encrypted
pad : Optional argument for decryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be dec... | [
"decrypt",
"(",
"data",
"[",
"pad",
"]",
"[",
"padmode",
"]",
")",
"-",
">",
"bytes"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L661-L680 | [
"def",
"decrypt",
"(",
"self",
",",
"data",
",",
"pad",
"=",
"None",
",",
"padmode",
"=",
"None",
")",
":",
"data",
"=",
"self",
".",
"_guardAgainstUnicode",
"(",
"data",
")",
"if",
"pad",
"is",
"not",
"None",
":",
"pad",
"=",
"self",
".",
"_guardA... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | triple_des.setKey | Will set the crypting key for this object. Either 16 or 24 bytes long. | universe/vncdriver/vendor/pydes.py | def setKey(self, key):
"""Will set the crypting key for this object. Either 16 or 24 bytes long."""
self.key_size = 24 # Use DES-EDE3 mode
if len(key) != self.key_size:
if len(key) == 16: # Use DES-EDE2 mode
self.key_size = 16
else:
raise ValueError("Invalid triple DES key size. Key must be either ... | def setKey(self, key):
"""Will set the crypting key for this object. Either 16 or 24 bytes long."""
self.key_size = 24 # Use DES-EDE3 mode
if len(key) != self.key_size:
if len(key) == 16: # Use DES-EDE2 mode
self.key_size = 16
else:
raise ValueError("Invalid triple DES key size. Key must be either ... | [
"Will",
"set",
"the",
"crypting",
"key",
"for",
"this",
"object",
".",
"Either",
"16",
"or",
"24",
"bytes",
"long",
"."
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L712-L735 | [
"def",
"setKey",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"key_size",
"=",
"24",
"# Use DES-EDE3 mode",
"if",
"len",
"(",
"key",
")",
"!=",
"self",
".",
"key_size",
":",
"if",
"len",
"(",
"key",
")",
"==",
"16",
":",
"# Use DES-EDE2 mode",
"se... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | triple_des.setMode | Sets the type of crypting mode, pyDes.ECB or pyDes.CBC | universe/vncdriver/vendor/pydes.py | def setMode(self, mode):
"""Sets the type of crypting mode, pyDes.ECB or pyDes.CBC"""
_baseDes.setMode(self, mode)
for key in (self.__key1, self.__key2, self.__key3):
key.setMode(mode) | def setMode(self, mode):
"""Sets the type of crypting mode, pyDes.ECB or pyDes.CBC"""
_baseDes.setMode(self, mode)
for key in (self.__key1, self.__key2, self.__key3):
key.setMode(mode) | [
"Sets",
"the",
"type",
"of",
"crypting",
"mode",
"pyDes",
".",
"ECB",
"or",
"pyDes",
".",
"CBC"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L739-L743 | [
"def",
"setMode",
"(",
"self",
",",
"mode",
")",
":",
"_baseDes",
".",
"setMode",
"(",
"self",
",",
"mode",
")",
"for",
"key",
"in",
"(",
"self",
".",
"__key1",
",",
"self",
".",
"__key2",
",",
"self",
".",
"__key3",
")",
":",
"key",
".",
"setMod... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | triple_des.setPadding | setPadding() -> bytes of length 1. Padding character. | universe/vncdriver/vendor/pydes.py | def setPadding(self, pad):
"""setPadding() -> bytes of length 1. Padding character."""
_baseDes.setPadding(self, pad)
for key in (self.__key1, self.__key2, self.__key3):
key.setPadding(pad) | def setPadding(self, pad):
"""setPadding() -> bytes of length 1. Padding character."""
_baseDes.setPadding(self, pad)
for key in (self.__key1, self.__key2, self.__key3):
key.setPadding(pad) | [
"setPadding",
"()",
"-",
">",
"bytes",
"of",
"length",
"1",
".",
"Padding",
"character",
"."
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L745-L749 | [
"def",
"setPadding",
"(",
"self",
",",
"pad",
")",
":",
"_baseDes",
".",
"setPadding",
"(",
"self",
",",
"pad",
")",
"for",
"key",
"in",
"(",
"self",
".",
"__key1",
",",
"self",
".",
"__key2",
",",
"self",
".",
"__key3",
")",
":",
"key",
".",
"se... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | triple_des.setPadMode | Sets the type of padding mode, pyDes.PAD_NORMAL or pyDes.PAD_PKCS5 | universe/vncdriver/vendor/pydes.py | def setPadMode(self, mode):
"""Sets the type of padding mode, pyDes.PAD_NORMAL or pyDes.PAD_PKCS5"""
_baseDes.setPadMode(self, mode)
for key in (self.__key1, self.__key2, self.__key3):
key.setPadMode(mode) | def setPadMode(self, mode):
"""Sets the type of padding mode, pyDes.PAD_NORMAL or pyDes.PAD_PKCS5"""
_baseDes.setPadMode(self, mode)
for key in (self.__key1, self.__key2, self.__key3):
key.setPadMode(mode) | [
"Sets",
"the",
"type",
"of",
"padding",
"mode",
"pyDes",
".",
"PAD_NORMAL",
"or",
"pyDes",
".",
"PAD_PKCS5"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L751-L755 | [
"def",
"setPadMode",
"(",
"self",
",",
"mode",
")",
":",
"_baseDes",
".",
"setPadMode",
"(",
"self",
",",
"mode",
")",
"for",
"key",
"in",
"(",
"self",
".",
"__key1",
",",
"self",
".",
"__key2",
",",
"self",
".",
"__key3",
")",
":",
"key",
".",
"... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | triple_des.setIV | Will set the Initial Value, used in conjunction with CBC mode | universe/vncdriver/vendor/pydes.py | def setIV(self, IV):
"""Will set the Initial Value, used in conjunction with CBC mode"""
_baseDes.setIV(self, IV)
for key in (self.__key1, self.__key2, self.__key3):
key.setIV(IV) | def setIV(self, IV):
"""Will set the Initial Value, used in conjunction with CBC mode"""
_baseDes.setIV(self, IV)
for key in (self.__key1, self.__key2, self.__key3):
key.setIV(IV) | [
"Will",
"set",
"the",
"Initial",
"Value",
"used",
"in",
"conjunction",
"with",
"CBC",
"mode"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L757-L761 | [
"def",
"setIV",
"(",
"self",
",",
"IV",
")",
":",
"_baseDes",
".",
"setIV",
"(",
"self",
",",
"IV",
")",
"for",
"key",
"in",
"(",
"self",
".",
"__key1",
",",
"self",
".",
"__key2",
",",
"self",
".",
"__key3",
")",
":",
"key",
".",
"setIV",
"(",... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | triple_des.decrypt | decrypt(data, [pad], [padmode]) -> bytes
data : bytes to be encrypted
pad : Optional argument for decryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be decrypted
with the already specified key. In PAD_NORMAL... | universe/vncdriver/vendor/pydes.py | def decrypt(self, data, pad=None, padmode=None):
"""decrypt(data, [pad], [padmode]) -> bytes
data : bytes to be encrypted
pad : Optional argument for decryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be dec... | def decrypt(self, data, pad=None, padmode=None):
"""decrypt(data, [pad], [padmode]) -> bytes
data : bytes to be encrypted
pad : Optional argument for decryption padding. Must only be one byte
padmode : Optional argument for overriding the padding mode.
The data must be a multiple of 8 bytes and will be dec... | [
"decrypt",
"(",
"data",
"[",
"pad",
"]",
"[",
"padmode",
"]",
")",
"-",
">",
"bytes"
] | openai/universe | python | https://github.com/openai/universe/blob/cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c/universe/vncdriver/vendor/pydes.py#L807-L852 | [
"def",
"decrypt",
"(",
"self",
",",
"data",
",",
"pad",
"=",
"None",
",",
"padmode",
"=",
"None",
")",
":",
"ENCRYPT",
"=",
"des",
".",
"ENCRYPT",
"DECRYPT",
"=",
"des",
".",
"DECRYPT",
"data",
"=",
"self",
".",
"_guardAgainstUnicode",
"(",
"data",
"... | cc9ce6ec241821bfb0f3b85dd455bd36e4ee7a8c |
train | WeChatPay.parse_payment_result | 解析微信支付结果通知 | wechatpy/pay/__init__.py | def parse_payment_result(self, xml):
"""解析微信支付结果通知"""
try:
data = xmltodict.parse(xml)
except (xmltodict.ParsingInterrupted, ExpatError):
raise InvalidSignatureException()
if not data or 'xml' not in data:
raise InvalidSignatureException()
da... | def parse_payment_result(self, xml):
"""解析微信支付结果通知"""
try:
data = xmltodict.parse(xml)
except (xmltodict.ParsingInterrupted, ExpatError):
raise InvalidSignatureException()
if not data or 'xml' not in data:
raise InvalidSignatureException()
da... | [
"解析微信支付结果通知"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/__init__.py#L196-L216 | [
"def",
"parse_payment_result",
"(",
"self",
",",
"xml",
")",
":",
"try",
":",
"data",
"=",
"xmltodict",
".",
"parse",
"(",
"xml",
")",
"except",
"(",
"xmltodict",
".",
"ParsingInterrupted",
",",
"ExpatError",
")",
":",
"raise",
"InvalidSignatureException",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.add_articles | 新增永久图文素材
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1494572718_WzHIY
:param articles: 图文素材数组
:type articles: list[dict]
:return: 返回的 JSON 数据包 | wechatpy/client/api/material.py | def add_articles(self, articles):
"""
新增永久图文素材
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1494572718_WzHIY
:param articles: 图文素材数组
:type articles: list[dict]
:return: 返回的 JSON 数据包
"""
articles_data = []
for article in articles:
a... | def add_articles(self, articles):
"""
新增永久图文素材
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1494572718_WzHIY
:param articles: 图文素材数组
:type articles: list[dict]
:return: 返回的 JSON 数据包
"""
articles_data = []
for article in articles:
a... | [
"新增永久图文素材",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1494572718_WzHIY"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L9-L37 | [
"def",
"add_articles",
"(",
"self",
",",
"articles",
")",
":",
"articles_data",
"=",
"[",
"]",
"for",
"article",
"in",
"articles",
":",
"articles_data",
".",
"append",
"(",
"{",
"'thumb_media_id'",
":",
"article",
"[",
"'thumb_media_id'",
"]",
",",
"'title'"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.add | 新增其它类型永久素材
详情请参考
http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object
:param title: 视频素材标题,仅上传视频素材时需要
:param introduction: 视频素材简介,仅上传视频素材时需要
... | wechatpy/client/api/material.py | def add(self, media_type, media_file, title=None, introduction=None):
"""
新增其它类型永久素材
详情请参考
http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object... | def add(self, media_type, media_file, title=None, introduction=None):
"""
新增其它类型永久素材
详情请参考
http://mp.weixin.qq.com/wiki/14/7e6c03263063f4813141c3e17dd4350a.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object... | [
"新增其它类型永久素材",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"14",
"/",
"7e6c03263063f4813141c3e17dd4350a",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L39-L69 | [
"def",
"add",
"(",
"self",
",",
"media_type",
",",
"media_file",
",",
"title",
"=",
"None",
",",
"introduction",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'access_token'",
":",
"self",
".",
"access_token",
",",
"'type'",
":",
"media_type",
"}",
"if",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.get | 获取永久素材
详情请参考
http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
:param media_id: 素材的 media_id
:return: 图文素材返回图文列表,其它类型为素材的内容 | wechatpy/client/api/material.py | def get(self, media_id):
"""
获取永久素材
详情请参考
http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
:param media_id: 素材的 media_id
:return: 图文素材返回图文列表,其它类型为素材的内容
"""
def _processor(res):
if isinstance(res, dict):
if '... | def get(self, media_id):
"""
获取永久素材
详情请参考
http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
:param media_id: 素材的 media_id
:return: 图文素材返回图文列表,其它类型为素材的内容
"""
def _processor(res):
if isinstance(res, dict):
if '... | [
"获取永久素材",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"4",
"/",
"b3546879f07623cb30df9ca0e420a5d0",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L71-L94 | [
"def",
"get",
"(",
"self",
",",
"media_id",
")",
":",
"def",
"_processor",
"(",
"res",
")",
":",
"if",
"isinstance",
"(",
"res",
",",
"dict",
")",
":",
"if",
"'news_item'",
"in",
"res",
":",
"# 图文素材",
"return",
"res",
"[",
"'news_item'",
"]",
"return... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.update_article | 修改永久图文素材
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为 0
:param article: 图文素材
:return: 返回的 JSON 数据包 | wechatpy/client/api/material.py | def update_article(self, media_id, index, article):
"""
修改永久图文素材
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为 0
:param article: 图文素材
:return: 返回的 J... | def update_article(self, media_id, index, article):
"""
修改永久图文素材
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为 0
:param article: 图文素材
:return: 返回的 J... | [
"修改永久图文素材",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?t",
"=",
"resource",
"/",
"res_main&id",
"=",
"mp1444738732"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L112-L139 | [
"def",
"update_article",
"(",
"self",
",",
"media_id",
",",
"index",
",",
"article",
")",
":",
"article_data",
"=",
"{",
"'thumb_media_id'",
":",
"article",
"[",
"'thumb_media_id'",
"]",
",",
"'title'",
":",
"article",
"[",
"'title'",
"]",
",",
"'content'",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.update_articles | 修改永久图文素材
详情请参考
http://mp.weixin.qq.com/wiki/4/19a59cba020d506e767360ca1be29450.html
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为 0
:param articles: 图文素材数组
:return: 返回的 JSON 数据包 | wechatpy/client/api/material.py | def update_articles(self, media_id, index, articles):
"""
修改永久图文素材
详情请参考
http://mp.weixin.qq.com/wiki/4/19a59cba020d506e767360ca1be29450.html
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为 0
:param articles: 图文素材数组
:retur... | def update_articles(self, media_id, index, articles):
"""
修改永久图文素材
详情请参考
http://mp.weixin.qq.com/wiki/4/19a59cba020d506e767360ca1be29450.html
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为 0
:param articles: 图文素材数组
:retur... | [
"修改永久图文素材",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"4",
"/",
"19a59cba020d506e767360ca1be29450",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L141-L152 | [
"def",
"update_articles",
"(",
"self",
",",
"media_id",
",",
"index",
",",
"articles",
")",
":",
"return",
"self",
".",
"update_article",
"(",
"media_id",
",",
"index",
",",
"articles",
"[",
"index",
"]",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.list_comment | 查看指定文章的评论数据 | wechatpy/client/api/material.py | def list_comment(self, msg_data_id, index=1, begin=0, count=50, type=0):
"""
查看指定文章的评论数据
"""
return self._post(
'comment/list',
data={
'msg_data_id': msg_data_id,
'index': index,
'begin': begin,
'coun... | def list_comment(self, msg_data_id, index=1, begin=0, count=50, type=0):
"""
查看指定文章的评论数据
"""
return self._post(
'comment/list',
data={
'msg_data_id': msg_data_id,
'index': index,
'begin': begin,
'coun... | [
"查看指定文章的评论数据"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L207-L219 | [
"def",
"list_comment",
"(",
"self",
",",
"msg_data_id",
",",
"index",
"=",
"1",
",",
"begin",
"=",
"0",
",",
"count",
"=",
"50",
",",
"type",
"=",
"0",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'comment/list'",
",",
"data",
"=",
"{",
"'msg_da... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.markelect_comment | 将评论标记精选 | wechatpy/client/api/material.py | def markelect_comment(self, msg_data_id, index, user_comment_id):
"""
将评论标记精选
"""
return self._post(
'comment/markelect',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
... | def markelect_comment(self, msg_data_id, index, user_comment_id):
"""
将评论标记精选
"""
return self._post(
'comment/markelect',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
... | [
"将评论标记精选"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L221-L231 | [
"def",
"markelect_comment",
"(",
"self",
",",
"msg_data_id",
",",
"index",
",",
"user_comment_id",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'comment/markelect'",
",",
"data",
"=",
"{",
"'msg_data_id'",
":",
"msg_data_id",
",",
"'index'",
":",
"index",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.unmarkelect_comment | 将评论取消精选 | wechatpy/client/api/material.py | def unmarkelect_comment(self, msg_data_id, index, user_comment_id):
"""
将评论取消精选
"""
return self._post(
'comment/unmarkelect',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
... | def unmarkelect_comment(self, msg_data_id, index, user_comment_id):
"""
将评论取消精选
"""
return self._post(
'comment/unmarkelect',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
... | [
"将评论取消精选"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L233-L243 | [
"def",
"unmarkelect_comment",
"(",
"self",
",",
"msg_data_id",
",",
"index",
",",
"user_comment_id",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'comment/unmarkelect'",
",",
"data",
"=",
"{",
"'msg_data_id'",
":",
"msg_data_id",
",",
"'index'",
":",
"index... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.delete_comment | 删除评论 | wechatpy/client/api/material.py | def delete_comment(self, msg_data_id, index, user_comment_id):
"""
删除评论
"""
return self._post(
'comment/delete',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
}) | def delete_comment(self, msg_data_id, index, user_comment_id):
"""
删除评论
"""
return self._post(
'comment/delete',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
}) | [
"删除评论"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L245-L255 | [
"def",
"delete_comment",
"(",
"self",
",",
"msg_data_id",
",",
"index",
",",
"user_comment_id",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'comment/delete'",
",",
"data",
"=",
"{",
"'msg_data_id'",
":",
"msg_data_id",
",",
"'index'",
":",
"index",
",",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.add_reply_comment | 回复评论 | wechatpy/client/api/material.py | def add_reply_comment(self, msg_data_id, index, user_comment_id, content):
"""
回复评论
"""
return self._post(
'comment/reply/add',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
... | def add_reply_comment(self, msg_data_id, index, user_comment_id, content):
"""
回复评论
"""
return self._post(
'comment/reply/add',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
... | [
"回复评论"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L257-L268 | [
"def",
"add_reply_comment",
"(",
"self",
",",
"msg_data_id",
",",
"index",
",",
"user_comment_id",
",",
"content",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'comment/reply/add'",
",",
"data",
"=",
"{",
"'msg_data_id'",
":",
"msg_data_id",
",",
"'index'",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.delete_reply_comment | 删除回复 | wechatpy/client/api/material.py | def delete_reply_comment(self, msg_data_id, index, user_comment_id):
"""
删除回复
"""
return self._post(
'comment/reply/delete',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
... | def delete_reply_comment(self, msg_data_id, index, user_comment_id):
"""
删除回复
"""
return self._post(
'comment/reply/delete',
data={
'msg_data_id': msg_data_id,
'index': index,
'user_comment_id': user_comment_id,
... | [
"删除回复"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/material.py#L270-L280 | [
"def",
"delete_reply_comment",
"(",
"self",
",",
"msg_data_id",
",",
"index",
",",
"user_comment_id",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'comment/reply/delete'",
",",
"data",
"=",
"{",
"'msg_data_id'",
":",
"msg_data_id",
",",
"'index'",
":",
"ind... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatService.get_provider_token | 获取服务商凭证
https://work.weixin.qq.com/api/doc#90001/90143/91200
:param provider_secret: 服务商的secret,在服务商管理后台可见
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/service.py | def get_provider_token(self, provider_secret):
"""
获取服务商凭证
https://work.weixin.qq.com/api/doc#90001/90143/91200
:param provider_secret: 服务商的secret,在服务商管理后台可见
:return: 返回的 JSON 数据包
"""
return self._post(
'service/get_provider_token',
data=... | def get_provider_token(self, provider_secret):
"""
获取服务商凭证
https://work.weixin.qq.com/api/doc#90001/90143/91200
:param provider_secret: 服务商的secret,在服务商管理后台可见
:return: 返回的 JSON 数据包
"""
return self._post(
'service/get_provider_token',
data=... | [
"获取服务商凭证"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/service.py#L16-L31 | [
"def",
"get_provider_token",
"(",
"self",
",",
"provider_secret",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'service/get_provider_token'",
",",
"data",
"=",
"{",
"'corpid'",
":",
"self",
".",
"_client",
".",
"corp_id",
",",
"'provider_secret'",
":",
"pro... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatService.get_suite_token | 获取第三方应用凭证
https://work.weixin.qq.com/api/doc#90001/90143/9060
:param suite_id: 以ww或wx开头应用id(对应于旧的以tj开头的套件id)
:param suite_secret: 应用secret
:param suite_ticket: 企业微信后台推送的ticket
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/service.py | def get_suite_token(self, suite_id, suite_secret, suite_ticket):
"""
获取第三方应用凭证
https://work.weixin.qq.com/api/doc#90001/90143/9060
:param suite_id: 以ww或wx开头应用id(对应于旧的以tj开头的套件id)
:param suite_secret: 应用secret
:param suite_ticket: 企业微信后台推送的ticket
:return: 返回的 JSO... | def get_suite_token(self, suite_id, suite_secret, suite_ticket):
"""
获取第三方应用凭证
https://work.weixin.qq.com/api/doc#90001/90143/9060
:param suite_id: 以ww或wx开头应用id(对应于旧的以tj开头的套件id)
:param suite_secret: 应用secret
:param suite_ticket: 企业微信后台推送的ticket
:return: 返回的 JSO... | [
"获取第三方应用凭证"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/service.py#L33-L51 | [
"def",
"get_suite_token",
"(",
"self",
",",
"suite_id",
",",
"suite_secret",
",",
"suite_ticket",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'service/get_suite_token'",
",",
"data",
"=",
"{",
"'suite_id'",
":",
"suite_id",
",",
"'suite_secret'",
":",
"sui... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatService.get_login_info | 获取企业号登录用户信息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=获取企业号登录用户信息
:param provider_access_token: 服务提供商的 accesstoken
:param auth_code: OAuth 2.0 授权企业号管理员登录产生的 code
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/service.py | def get_login_info(self, auth_code, provider_access_token=None):
"""
获取企业号登录用户信息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=获取企业号登录用户信息
:param provider_access_token: 服务提供商的 accesstoken
:param auth_code: OAuth 2.0 授权企业号管理员登录产生的 code
:return: 返回的 JSON ... | def get_login_info(self, auth_code, provider_access_token=None):
"""
获取企业号登录用户信息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=获取企业号登录用户信息
:param provider_access_token: 服务提供商的 accesstoken
:param auth_code: OAuth 2.0 授权企业号管理员登录产生的 code
:return: 返回的 JSON ... | [
"获取企业号登录用户信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/service.py#L53-L72 | [
"def",
"get_login_info",
"(",
"self",
",",
"auth_code",
",",
"provider_access_token",
"=",
"None",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'service/get_login_info'",
",",
"params",
"=",
"{",
"'provider_access_token'",
":",
"provider_access_token",
",",
"}"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatService.get_login_url | 获取登录企业号官网的url
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=获取登录企业号官网的url
:param provider_access_token: 服务提供商的 accesstoken
:param login_ticket: 通过get_login_info得到的login_ticket, 10小时有效
:param target: 登录跳转到企业号后台的目标页面
:param agentid: 可选,授权方应用id
:return: 返回... | wechatpy/enterprise/client/api/service.py | def get_login_url(self, login_ticket, target, agentid=None, provider_access_token=None):
"""
获取登录企业号官网的url
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=获取登录企业号官网的url
:param provider_access_token: 服务提供商的 accesstoken
:param login_ticket: 通过get_login_info得到的login... | def get_login_url(self, login_ticket, target, agentid=None, provider_access_token=None):
"""
获取登录企业号官网的url
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=获取登录企业号官网的url
:param provider_access_token: 服务提供商的 accesstoken
:param login_ticket: 通过get_login_info得到的login... | [
"获取登录企业号官网的url"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/service.py#L74-L97 | [
"def",
"get_login_url",
"(",
"self",
",",
"login_ticket",
",",
"target",
",",
"agentid",
"=",
"None",
",",
"provider_access_token",
"=",
"None",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'service/get_login_url'",
",",
"params",
"=",
"{",
"'provider_acces... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDataCube.get_user_summary | 获取用户增减数据
详情请参考
http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html
:param begin_date: 起始日期
:param end_date: 结束日期
:return: 统计数据列表 | wechatpy/client/api/datacube.py | def get_user_summary(self, begin_date, end_date):
"""
获取用户增减数据
详情请参考
http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html
:param begin_date: 起始日期
:param end_date: 结束日期
:return: 统计数据列表
"""
res = self._post(
'getusersumma... | def get_user_summary(self, begin_date, end_date):
"""
获取用户增减数据
详情请参考
http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html
:param begin_date: 起始日期
:param end_date: 结束日期
:return: 统计数据列表
"""
res = self._post(
'getusersumma... | [
"获取用户增减数据",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"3",
"/",
"ecfed6e1a0a03b5f35e5efac98e864b7",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/datacube.py#L23-L40 | [
"def",
"get_user_summary",
"(",
"self",
",",
"begin_date",
",",
"end_date",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"'getusersummary'",
",",
"data",
"=",
"{",
"'begin_date'",
":",
"self",
".",
"_to_date_str",
"(",
"begin_date",
")",
",",
"'end_dat... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDataCube.get_user_cumulate | 获取累计用户数据
详情请参考
http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html
:param begin_date: 起始日期
:param end_date: 结束日期
:return: 统计数据列表 | wechatpy/client/api/datacube.py | def get_user_cumulate(self, begin_date, end_date):
"""
获取累计用户数据
详情请参考
http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html
:param begin_date: 起始日期
:param end_date: 结束日期
:return: 统计数据列表
"""
res = self._post(
'getusercumu... | def get_user_cumulate(self, begin_date, end_date):
"""
获取累计用户数据
详情请参考
http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html
:param begin_date: 起始日期
:param end_date: 结束日期
:return: 统计数据列表
"""
res = self._post(
'getusercumu... | [
"获取累计用户数据",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"3",
"/",
"ecfed6e1a0a03b5f35e5efac98e864b7",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/datacube.py#L42-L60 | [
"def",
"get_user_cumulate",
"(",
"self",
",",
"begin_date",
",",
"end_date",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"'getusercumulate'",
",",
"data",
"=",
"{",
"'begin_date'",
":",
"self",
".",
"_to_date_str",
"(",
"begin_date",
")",
",",
"'end_d... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatTransfer.transfer | 企业付款接口
:param user_id: 接受收红包的用户在公众号下的 openid
:param amount: 付款金额,单位分
:param desc: 付款说明
:param client_ip: 可选,调用接口机器的 IP 地址
:param check_name: 可选,校验用户姓名选项,
NO_CHECK:不校验真实姓名,
FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账),
... | wechatpy/pay/api/transfer.py | def transfer(self, user_id, amount, desc, client_ip=None,
check_name='OPTION_CHECK', real_name=None,
out_trade_no=None, device_info=None):
"""
企业付款接口
:param user_id: 接受收红包的用户在公众号下的 openid
:param amount: 付款金额,单位分
:param desc: 付款说明
:param ... | def transfer(self, user_id, amount, desc, client_ip=None,
check_name='OPTION_CHECK', real_name=None,
out_trade_no=None, device_info=None):
"""
企业付款接口
:param user_id: 接受收红包的用户在公众号下的 openid
:param amount: 付款金额,单位分
:param desc: 付款说明
:param ... | [
"企业付款接口"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/transfer.py#L12-L52 | [
"def",
"transfer",
"(",
"self",
",",
"user_id",
",",
"amount",
",",
"desc",
",",
"client_ip",
"=",
"None",
",",
"check_name",
"=",
"'OPTION_CHECK'",
",",
"real_name",
"=",
"None",
",",
"out_trade_no",
"=",
"None",
",",
"device_info",
"=",
"None",
")",
":... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatTransfer.transfer_bankcard | 企业付款到银行卡接口
:param true_name: 开户人名称
:param bank_card_no: 银行卡号
:param bank_code: 银行编号
:param amount: 付款金额,单位分
:param desc: 付款说明
:param out_trade_no: 可选,商户订单号,需保持唯一性,默认自动生成
:return: 返回的结果信息 | wechatpy/pay/api/transfer.py | def transfer_bankcard(self, true_name, bank_card_no, bank_code, amount, desc=None, out_trade_no=None):
"""
企业付款到银行卡接口
:param true_name: 开户人名称
:param bank_card_no: 银行卡号
:param bank_code: 银行编号
:param amount: 付款金额,单位分
:param desc: 付款说明
:param out_trade_no: 可... | def transfer_bankcard(self, true_name, bank_card_no, bank_code, amount, desc=None, out_trade_no=None):
"""
企业付款到银行卡接口
:param true_name: 开户人名称
:param bank_card_no: 银行卡号
:param bank_code: 银行编号
:param amount: 付款金额,单位分
:param desc: 付款说明
:param out_trade_no: 可... | [
"企业付款到银行卡接口"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/transfer.py#L67-L95 | [
"def",
"transfer_bankcard",
"(",
"self",
",",
"true_name",
",",
"bank_card_no",
",",
"bank_code",
",",
"amount",
",",
"desc",
"=",
"None",
",",
"out_trade_no",
"=",
"None",
")",
":",
"if",
"not",
"out_trade_no",
":",
"now",
"=",
"datetime",
".",
"now",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatTransfer.query_bankcard | 企业付款查询接口
:param out_trade_no: 商户调用企业付款API时使用的商户订单号
:return: 返回的结果数据 | wechatpy/pay/api/transfer.py | def query_bankcard(self, out_trade_no):
"""
企业付款查询接口
:param out_trade_no: 商户调用企业付款API时使用的商户订单号
:return: 返回的结果数据
"""
data = {
'mch_id': self.mch_id,
'partner_trade_no': out_trade_no,
}
return self._post('mmpaysptrans/query_bank', da... | def query_bankcard(self, out_trade_no):
"""
企业付款查询接口
:param out_trade_no: 商户调用企业付款API时使用的商户订单号
:return: 返回的结果数据
"""
data = {
'mch_id': self.mch_id,
'partner_trade_no': out_trade_no,
}
return self._post('mmpaysptrans/query_bank', da... | [
"企业付款查询接口"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/transfer.py#L97-L108 | [
"def",
"query_bankcard",
"(",
"self",
",",
"out_trade_no",
")",
":",
"data",
"=",
"{",
"'mch_id'",
":",
"self",
".",
"mch_id",
",",
"'partner_trade_no'",
":",
"out_trade_no",
",",
"}",
"return",
"self",
".",
"_post",
"(",
"'mmpaysptrans/query_bank'",
",",
"d... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatTemplate.get | 获得模板ID
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277
:param template_id_short: 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
:return: 模板 ID | wechatpy/client/api/template.py | def get(self, template_id_short):
"""
获得模板ID
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277
:param template_id_short: 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
:return: 模板 ID
"""
res = self._post(
'template/api_add_template',
... | def get(self, template_id_short):
"""
获得模板ID
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277
:param template_id_short: 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
:return: 模板 ID
"""
res = self._post(
'template/api_add_template',
... | [
"获得模板ID",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?t",
"=",
"resource",
"/",
"res_main&id",
"=",
"mp1433751277"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/template.py#L39-L55 | [
"def",
"get",
"(",
"self",
",",
"template_id_short",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"'template/api_add_template'",
",",
"data",
"=",
"{",
"'template_id_short'",
":",
"template_id_short",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.apply_device_id | 申请设备ID
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param quantity: 申请的设备ID的数量,单次新增设备超过500个,需走人工审核流程
:param reason: 申请理由,不超过100个字
:param poi_id: 可选,设备关联的门店ID
:param comment: 可选,备注,不超过15个汉字或30个英文字母
:return: 申请的设备信息 | wechatpy/client/api/shakearound.py | def apply_device_id(self, quantity, reason, poi_id=None, comment=None):
"""
申请设备ID
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param quantity: 申请的设备ID的数量,单次新增设备超过500个,需走人工审核流程
:param reason: 申请理由,不超过100个字
:param poi_id: 可选,设备关联的门店... | def apply_device_id(self, quantity, reason, poi_id=None, comment=None):
"""
申请设备ID
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param quantity: 申请的设备ID的数量,单次新增设备超过500个,需走人工审核流程
:param reason: 申请理由,不超过100个字
:param poi_id: 可选,设备关联的门店... | [
"申请设备ID",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"15",
"/",
"b9e012f917e3484b7ed02771156411f3",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L25-L47 | [
"def",
"apply_device_id",
"(",
"self",
",",
"quantity",
",",
"reason",
",",
"poi_id",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
")",
"data",
"[",
"'quantity'",
"]",
"=",
"quantity",
"data",
"[",
"'apply_reason'... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.update_device | 更新设备信息
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先
:param uuid: UUID
:param major: major
:param minor: minor
:param comment: 设备的备注信息,不超过15个汉字或30个英文字母。
:ret... | wechatpy/client/api/shakearound.py | def update_device(self, device_id=None, uuid=None, major=None,
minor=None, comment=None):
"""
更新设备信息
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先
:par... | def update_device(self, device_id=None, uuid=None, major=None,
minor=None, comment=None):
"""
更新设备信息
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先
:par... | [
"更新设备信息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"15",
"/",
"b9e012f917e3484b7ed02771156411f3",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L49-L74 | [
"def",
"update_device",
"(",
"self",
",",
"device_id",
"=",
"None",
",",
"uuid",
"=",
"None",
",",
"major",
"=",
"None",
",",
"minor",
"=",
"None",
",",
"comment",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
")",
"data",
"[",
"'comment'"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.bind_device_location | 配置设备与门店的关联关系
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param poi_id: 待关联的门店ID
:param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先
:param uuid: UUID
:param major: major
:param minor: minor
:return: 返回的 JSO... | wechatpy/client/api/shakearound.py | def bind_device_location(self, poi_id, device_id=None, uuid=None,
major=None, minor=None):
"""
配置设备与门店的关联关系
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param poi_id: 待关联的门店ID
:param device_id: 设备编号,若填了UUID、maj... | def bind_device_location(self, poi_id, device_id=None, uuid=None,
major=None, minor=None):
"""
配置设备与门店的关联关系
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param poi_id: 待关联的门店ID
:param device_id: 设备编号,若填了UUID、maj... | [
"配置设备与门店的关联关系",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"15",
"/",
"b9e012f917e3484b7ed02771156411f3",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L76-L101 | [
"def",
"bind_device_location",
"(",
"self",
",",
"poi_id",
",",
"device_id",
"=",
"None",
",",
"uuid",
"=",
"None",
",",
"major",
"=",
"None",
",",
"minor",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
")",
"data",
"[",
"'poi_id'",
"]",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.search_device | 查询设备列表
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param identifiers: 设备 ID 信息列表
:param apply_id: 批次ID,申请设备ID超出500个时所返回批次ID
:param begin: 设备列表的起始索引值
:param count: 待查询的设备个数
:return: 设备列表 | wechatpy/client/api/shakearound.py | def search_device(self, identifiers=None, apply_id=None,
begin=0, count=10):
"""
查询设备列表
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param identifiers: 设备 ID 信息列表
:param apply_id: 批次ID,申请设备ID超出500个时所返回批次ID
:pa... | def search_device(self, identifiers=None, apply_id=None,
begin=0, count=10):
"""
查询设备列表
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param identifiers: 设备 ID 信息列表
:param apply_id: 批次ID,申请设备ID超出500个时所返回批次ID
:pa... | [
"查询设备列表",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"15",
"/",
"b9e012f917e3484b7ed02771156411f3",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L103-L127 | [
"def",
"search_device",
"(",
"self",
",",
"identifiers",
"=",
"None",
",",
"apply_id",
"=",
"None",
",",
"begin",
"=",
"0",
",",
"count",
"=",
"10",
")",
":",
"data",
"=",
"optionaldict",
"(",
")",
"data",
"[",
"'begin'",
"]",
"=",
"begin",
"data",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.update_page | 编辑页面信息
详情请参考
http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html
:param page_id: 摇周边页面唯一ID
:param title: 在摇一摇页面展示的主标题,不超过6个字
:param description: 在摇一摇页面展示的副标题,不超过7个字
:param icon_url: 在摇一摇页面展示的图片。图片需先上传至微信侧服务器,
用“素材管理-上传图片素材”接口上传图片,... | wechatpy/client/api/shakearound.py | def update_page(self, page_id, title, description,
icon_url, page_url, comment=None):
"""
编辑页面信息
详情请参考
http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html
:param page_id: 摇周边页面唯一ID
:param title: 在摇一摇页面展示的主标题,不超过6个字
:param desc... | def update_page(self, page_id, title, description,
icon_url, page_url, comment=None):
"""
编辑页面信息
详情请参考
http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html
:param page_id: 摇周边页面唯一ID
:param title: 在摇一摇页面展示的主标题,不超过6个字
:param desc... | [
"编辑页面信息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"5",
"/",
"6626199ea8757c752046d8e46cf13251",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L156-L184 | [
"def",
"update_page",
"(",
"self",
",",
"page_id",
",",
"title",
",",
"description",
",",
"icon_url",
",",
"page_url",
",",
"comment",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
")",
"data",
"[",
"'page_id'",
"]",
"=",
"page_id",
"data",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.search_pages | 查询页面列表
详情请参考
http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html
:param page_ids: 指定页面的id列表
:param begin: 页面列表的起始索引值
:param count: 待查询的页面个数
:return: 页面查询结果信息 | wechatpy/client/api/shakearound.py | def search_pages(self, page_ids=None, begin=0, count=10):
"""
查询页面列表
详情请参考
http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html
:param page_ids: 指定页面的id列表
:param begin: 页面列表的起始索引值
:param count: 待查询的页面个数
:return: 页面查询结果信息
"""
... | def search_pages(self, page_ids=None, begin=0, count=10):
"""
查询页面列表
详情请参考
http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html
:param page_ids: 指定页面的id列表
:param begin: 页面列表的起始索引值
:param count: 待查询的页面个数
:return: 页面查询结果信息
"""
... | [
"查询页面列表",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"5",
"/",
"6626199ea8757c752046d8e46cf13251",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L186-L216 | [
"def",
"search_pages",
"(",
"self",
",",
"page_ids",
"=",
"None",
",",
"begin",
"=",
"0",
",",
"count",
"=",
"10",
")",
":",
"if",
"not",
"page_ids",
":",
"data",
"=",
"{",
"'type'",
":",
"2",
",",
"'begin'",
":",
"begin",
",",
"'count'",
":",
"c... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.add_material | 上传图片素材
详情请参考
http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
:param media_file: 要上传的文件,一个 File-object
:param media_type: 摇一摇素材类型, 取值为 icon或者 license, 默认 icon.
:return: 上传的素材信息 | wechatpy/client/api/shakearound.py | def add_material(self, media_file, media_type='icon'):
"""
上传图片素材
详情请参考
http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
:param media_file: 要上传的文件,一个 File-object
:param media_type: 摇一摇素材类型, 取值为 icon或者 license, 默认 icon.
:return: 上传的素材信息
... | def add_material(self, media_file, media_type='icon'):
"""
上传图片素材
详情请参考
http://mp.weixin.qq.com/wiki/5/e997428269ff189d8f9a4b9e177be2d9.html
:param media_file: 要上传的文件,一个 File-object
:param media_type: 摇一摇素材类型, 取值为 icon或者 license, 默认 icon.
:return: 上传的素材信息
... | [
"上传图片素材",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"5",
"/",
"e997428269ff189d8f9a4b9e177be2d9",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L234-L254 | [
"def",
"add_material",
"(",
"self",
",",
"media_file",
",",
"media_type",
"=",
"'icon'",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"'shakearound/material/add'",
",",
"files",
"=",
"{",
"'media'",
":",
"media_file",
"}",
",",
"params",
"=",
"{",
"'... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.bind_device_pages | 配置设备与页面的关联关系
详情请参考
http://mp.weixin.qq.com/wiki/12/c8120214ec0ba08af5dfcc0da1a11400.html
:param page_ids: 待关联的页面列表
:param bind: 关联操作标志位, 0为解除关联关系,1为建立关联关系
:param append: 新增操作标志位, 0为覆盖,1为新增
:param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先
:param... | wechatpy/client/api/shakearound.py | def bind_device_pages(self, page_ids, bind, append, device_id=None,
uuid=None, major=None, minor=None):
"""
配置设备与页面的关联关系
详情请参考
http://mp.weixin.qq.com/wiki/12/c8120214ec0ba08af5dfcc0da1a11400.html
:param page_ids: 待关联的页面列表
:param bind: 关联操作标志位, ... | def bind_device_pages(self, page_ids, bind, append, device_id=None,
uuid=None, major=None, minor=None):
"""
配置设备与页面的关联关系
详情请参考
http://mp.weixin.qq.com/wiki/12/c8120214ec0ba08af5dfcc0da1a11400.html
:param page_ids: 待关联的页面列表
:param bind: 关联操作标志位, ... | [
"配置设备与页面的关联关系",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"12",
"/",
"c8120214ec0ba08af5dfcc0da1a11400",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L256-L288 | [
"def",
"bind_device_pages",
"(",
"self",
",",
"page_ids",
",",
"bind",
",",
"append",
",",
"device_id",
"=",
"None",
",",
"uuid",
"=",
"None",
",",
"major",
"=",
"None",
",",
"minor",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"page_ids",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.get_shake_info | 获取摇周边的设备及用户信息
详情请参考
http://mp.weixin.qq.com/wiki/3/34904a5db3d0ec7bb5306335b8da1faf.html
:param ticket: 摇周边业务的ticket,可在摇到的URL中得到,ticket生效时间为30分钟
:return: 设备及用户信息 | wechatpy/client/api/shakearound.py | def get_shake_info(self, ticket):
"""
获取摇周边的设备及用户信息
详情请参考
http://mp.weixin.qq.com/wiki/3/34904a5db3d0ec7bb5306335b8da1faf.html
:param ticket: 摇周边业务的ticket,可在摇到的URL中得到,ticket生效时间为30分钟
:return: 设备及用户信息
"""
res = self._post(
'shakearound/user/get... | def get_shake_info(self, ticket):
"""
获取摇周边的设备及用户信息
详情请参考
http://mp.weixin.qq.com/wiki/3/34904a5db3d0ec7bb5306335b8da1faf.html
:param ticket: 摇周边业务的ticket,可在摇到的URL中得到,ticket生效时间为30分钟
:return: 设备及用户信息
"""
res = self._post(
'shakearound/user/get... | [
"获取摇周边的设备及用户信息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"3",
"/",
"34904a5db3d0ec7bb5306335b8da1faf",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L290-L306 | [
"def",
"get_shake_info",
"(",
"self",
",",
"ticket",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"'shakearound/user/getshakeinfo'",
",",
"data",
"=",
"{",
"'ticket'",
":",
"ticket",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"'... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.get_device_statistics | 以设备为维度的数据统计接口
http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html
:param begin_date: 起始时间,最长时间跨度为30天
:param end_date: 结束时间,最长时间跨度为30天
:param device_id: 设备编号,若填了UUID、major、minor,则可不填设备编号,若二者都填,则以设备编号为优先
:param uuid: UUID
:param major: major
:param... | wechatpy/client/api/shakearound.py | def get_device_statistics(self, begin_date, end_date, device_id=None,
uuid=None, major=None, minor=None):
"""
以设备为维度的数据统计接口
http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html
:param begin_date: 起始时间,最长时间跨度为30天
:param end_date: 结束时间... | def get_device_statistics(self, begin_date, end_date, device_id=None,
uuid=None, major=None, minor=None):
"""
以设备为维度的数据统计接口
http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html
:param begin_date: 起始时间,最长时间跨度为30天
:param end_date: 结束时间... | [
"以设备为维度的数据统计接口",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"0",
"/",
"8a24bcacad40fe7ee98d1573cb8a6764",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L308-L336 | [
"def",
"get_device_statistics",
"(",
"self",
",",
"begin_date",
",",
"end_date",
",",
"device_id",
"=",
"None",
",",
"uuid",
"=",
"None",
",",
"major",
"=",
"None",
",",
"minor",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'device_identifier'",
":",
"{",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.get_page_statistics | 以页面为维度的数据统计接口
详情请参考
http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html
:param page_id: 页面 ID
:param begin_date: 起始时间,最长时间跨度为30天
:param end_date: 结束时间,最长时间跨度为30天
:return: 统计数据 | wechatpy/client/api/shakearound.py | def get_page_statistics(self, page_id, begin_date, end_date):
"""
以页面为维度的数据统计接口
详情请参考
http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html
:param page_id: 页面 ID
:param begin_date: 起始时间,最长时间跨度为30天
:param end_date: 结束时间,最长时间跨度为30天
:return: 统... | def get_page_statistics(self, page_id, begin_date, end_date):
"""
以页面为维度的数据统计接口
详情请参考
http://mp.weixin.qq.com/wiki/0/8a24bcacad40fe7ee98d1573cb8a6764.html
:param page_id: 页面 ID
:param begin_date: 起始时间,最长时间跨度为30天
:param end_date: 结束时间,最长时间跨度为30天
:return: 统... | [
"以页面为维度的数据统计接口",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"0",
"/",
"8a24bcacad40fe7ee98d1573cb8a6764",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L338-L358 | [
"def",
"get_page_statistics",
"(",
"self",
",",
"page_id",
",",
"begin_date",
",",
"end_date",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"'shakearound/statistics/page'",
",",
"data",
"=",
"{",
"'page_id'",
":",
"page_id",
",",
"'begin_date'",
":",
"se... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatShakeAround.get_apply_status | 查询设备ID申请审核状态
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param apply_id: 批次ID,申请设备ID时所返回的批次ID
:return: 批次状态信息 | wechatpy/client/api/shakearound.py | def get_apply_status(self, apply_id):
"""
查询设备ID申请审核状态
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param apply_id: 批次ID,申请设备ID时所返回的批次ID
:return: 批次状态信息
"""
res = self._post(
'shakearound/device/applystatus',
... | def get_apply_status(self, apply_id):
"""
查询设备ID申请审核状态
详情请参考
http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html
:param apply_id: 批次ID,申请设备ID时所返回的批次ID
:return: 批次状态信息
"""
res = self._post(
'shakearound/device/applystatus',
... | [
"查询设备ID申请审核状态",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"15",
"/",
"b9e012f917e3484b7ed02771156411f3",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L360-L376 | [
"def",
"get_apply_status",
"(",
"self",
",",
"apply_id",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"'shakearound/device/applystatus'",
",",
"data",
"=",
"{",
"'apply_id'",
":",
"apply_id",
",",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatWithhold.apply_signing | 申请签约 api
https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_1&index=1
:param plan_id: 模板id 协议模板id,设置路径见开发步骤。
:param contract_code: 签约协议号 商户侧的签约协议号,由商户生成
:param contract_display_account: 用户账户展示名称 签约用户的名称,用于页面展示,页面样例可见案例与规范
:param notify_url: 回调通知url 用于接收签约成功消息的回调通知地址,以htt... | wechatpy/pay/api/withhold.py | def apply_signing(self, plan_id, contract_code, contract_display_account, notify_url,
version="1.0", clientip=None, deviceid=None, mobile=None, email=None, qq=None,
request_serial=None, openid=None, creid=None, outerid=None):
"""
申请签约 api
https://pay.... | def apply_signing(self, plan_id, contract_code, contract_display_account, notify_url,
version="1.0", clientip=None, deviceid=None, mobile=None, email=None, qq=None,
request_serial=None, openid=None, creid=None, outerid=None):
"""
申请签约 api
https://pay.... | [
"申请签约",
"api"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/withhold.py#L16-L69 | [
"def",
"apply_signing",
"(",
"self",
",",
"plan_id",
",",
"contract_code",
",",
"contract_display_account",
",",
"notify_url",
",",
"version",
"=",
"\"1.0\"",
",",
"clientip",
"=",
"None",
",",
"deviceid",
"=",
"None",
",",
"mobile",
"=",
"None",
",",
"email... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatWithhold.query_signing | 查询签约关系 api
:param contract_id: 可选 委托代扣协议id 委托代扣签约成功后由微信返回的委托代扣协议id,选择contract_id查询,则此参数必填
:param plan_id: 可选 模板id 商户在微信商户平台配置的代扣模板id,选择plan_id+contract_code查询,则此参数必填
:param contract_code: 可选 签约协议号 商户请求签约时传入的签约协议号,商户侧须唯一。选择plan_id+contract_code查询,则此参数必填
:param openid: 可选 openid 用户标识,必须保证... | wechatpy/pay/api/withhold.py | def query_signing(self, contract_id=None, plan_id=None, contract_code=None, openid=None, version="1.0"):
"""
查询签约关系 api
:param contract_id: 可选 委托代扣协议id 委托代扣签约成功后由微信返回的委托代扣协议id,选择contract_id查询,则此参数必填
:param plan_id: 可选 模板id 商户在微信商户平台配置的代扣模板id,选择plan_id+contract_code查询,则此参数必填
:par... | def query_signing(self, contract_id=None, plan_id=None, contract_code=None, openid=None, version="1.0"):
"""
查询签约关系 api
:param contract_id: 可选 委托代扣协议id 委托代扣签约成功后由微信返回的委托代扣协议id,选择contract_id查询,则此参数必填
:param plan_id: 可选 模板id 商户在微信商户平台配置的代扣模板id,选择plan_id+contract_code查询,则此参数必填
:par... | [
"查询签约关系",
"api"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/withhold.py#L71-L94 | [
"def",
"query_signing",
"(",
"self",
",",
"contract_id",
"=",
"None",
",",
"plan_id",
"=",
"None",
",",
"contract_code",
"=",
"None",
",",
"openid",
"=",
"None",
",",
"version",
"=",
"\"1.0\"",
")",
":",
"if",
"not",
"contract_id",
"and",
"not",
"(",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatWithhold.apply_deduct | 申请扣款 api
:param body: 商品描述 商品或支付单简要描述
:param out_trade_no: 可选 商户订单号 商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号
:param total_fee: 总金额 订单总金额,单位为分,只能为整数,详见支付金额
:param contract_id: 委托代扣协议id 签约成功后,微信返回的委托代扣协议id
:param notify_url: 回调通知url 接受扣款结果异步回调通知的url
:param detail: 可选 商品详情 商品名称明... | wechatpy/pay/api/withhold.py | def apply_deduct(self, body, total_fee, contract_id, notify_url, out_trade_no=None,
detail=None, attach=None, fee_type='CNY', goods_tag=None, clientip=None, deviceid=None,
mobile=None, email=None, qq=None, openid=None, creid=None, outerid=None):
"""
申请扣款 api
... | def apply_deduct(self, body, total_fee, contract_id, notify_url, out_trade_no=None,
detail=None, attach=None, fee_type='CNY', goods_tag=None, clientip=None, deviceid=None,
mobile=None, email=None, qq=None, openid=None, creid=None, outerid=None):
"""
申请扣款 api
... | [
"申请扣款",
"api"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/withhold.py#L96-L156 | [
"def",
"apply_deduct",
"(",
"self",
",",
"body",
",",
"total_fee",
",",
"contract_id",
",",
"notify_url",
",",
"out_trade_no",
"=",
"None",
",",
"detail",
"=",
"None",
",",
"attach",
"=",
"None",
",",
"fee_type",
"=",
"'CNY'",
",",
"goods_tag",
"=",
"Non... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatWithhold.query_order | 查询订单 api
:param transaction_id: 二选一 微信订单号 微信的订单号,优先使用
:param out_trade_no: 二选一 商户订单号 商户系统内部的订单号,当没提供transaction_id时需要传这个。
:return: 返回的结果信息 | wechatpy/pay/api/withhold.py | def query_order(self, transaction_id=None, out_trade_no=None):
"""
查询订单 api
:param transaction_id: 二选一 微信订单号 微信的订单号,优先使用
:param out_trade_no: 二选一 商户订单号 商户系统内部的订单号,当没提供transaction_id时需要传这个。
:return: 返回的结果信息
"""
if not transaction_id and not out_trade_no:
... | def query_order(self, transaction_id=None, out_trade_no=None):
"""
查询订单 api
:param transaction_id: 二选一 微信订单号 微信的订单号,优先使用
:param out_trade_no: 二选一 商户订单号 商户系统内部的订单号,当没提供transaction_id时需要传这个。
:return: 返回的结果信息
"""
if not transaction_id and not out_trade_no:
... | [
"查询订单",
"api"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/withhold.py#L158-L174 | [
"def",
"query_order",
"(",
"self",
",",
"transaction_id",
"=",
"None",
",",
"out_trade_no",
"=",
"None",
")",
":",
"if",
"not",
"transaction_id",
"and",
"not",
"out_trade_no",
":",
"raise",
"ValueError",
"(",
"\"transaction_id and out_trade_no must be a choice.\"",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatWithhold.apply_cancel_signing | 申请解约
https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_4&index=6
:param contract_id: 合同ID
:param plan_id: 模板ID
:param contract_code: 合同号
:param contract_termination_remark: 解约原因
:param version: 版本号
:return: | wechatpy/pay/api/withhold.py | def apply_cancel_signing(self, contract_id=None, plan_id=None, contract_code=None,
contract_termination_remark=None, version="1.0"):
"""
申请解约
https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_4&index=6
:param contract_id: 合同ID
:param plan_id... | def apply_cancel_signing(self, contract_id=None, plan_id=None, contract_code=None,
contract_termination_remark=None, version="1.0"):
"""
申请解约
https://pay.weixin.qq.com/wiki/doc/api/pap.php?chapter=18_4&index=6
:param contract_id: 合同ID
:param plan_id... | [
"申请解约"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/withhold.py#L176-L202 | [
"def",
"apply_cancel_signing",
"(",
"self",
",",
"contract_id",
"=",
"None",
",",
"plan_id",
"=",
"None",
",",
"contract_code",
"=",
"None",
",",
"contract_termination_remark",
"=",
"None",
",",
"version",
"=",
"\"1.0\"",
")",
":",
"if",
"not",
"(",
"contrac... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatScan.modify_product_status | 提交审核/取消发布商品
详情请参考
http://mp.weixin.qq.com/wiki/15/1007691d0f1c10a0588c6517f12ed70f.html
:param standard: 商品编码标准
:param key: 商品编码内容
:param status: 设置发布状态。on 为提交审核,off 为取消发布
:return: 返回的 JSON 数据包 | wechatpy/client/api/scan.py | def modify_product_status(self, standard, key, status):
"""
提交审核/取消发布商品
详情请参考
http://mp.weixin.qq.com/wiki/15/1007691d0f1c10a0588c6517f12ed70f.html
:param standard: 商品编码标准
:param key: 商品编码内容
:param status: 设置发布状态。on 为提交审核,off 为取消发布
:return: 返回的 JSON 数据包
... | def modify_product_status(self, standard, key, status):
"""
提交审核/取消发布商品
详情请参考
http://mp.weixin.qq.com/wiki/15/1007691d0f1c10a0588c6517f12ed70f.html
:param standard: 商品编码标准
:param key: 商品编码内容
:param status: 设置发布状态。on 为提交审核,off 为取消发布
:return: 返回的 JSON 数据包
... | [
"提交审核",
"/",
"取消发布商品"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/scan.py#L40-L57 | [
"def",
"modify_product_status",
"(",
"self",
",",
"standard",
",",
"key",
",",
"status",
")",
":",
"data",
"=",
"{",
"'keystandard'",
":",
"standard",
",",
"'keystr'",
":",
"key",
",",
"'status'",
":",
"status",
",",
"}",
"return",
"self",
".",
"_post",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatScan.get_product | 查询商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param standard: 商品编码标准
:param key: 商品编码内容
:return: 返回的 JSON 数据包 | wechatpy/client/api/scan.py | def get_product(self, standard, key):
"""
查询商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param standard: 商品编码标准
:param key: 商品编码内容
:return: 返回的 JSON 数据包
"""
data = {
'keystandard': standard,
... | def get_product(self, standard, key):
"""
查询商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param standard: 商品编码标准
:param key: 商品编码内容
:return: 返回的 JSON 数据包
"""
data = {
'keystandard': standard,
... | [
"查询商品信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/scan.py#L94-L109 | [
"def",
"get_product",
"(",
"self",
",",
"standard",
",",
"key",
")",
":",
"data",
"=",
"{",
"'keystandard'",
":",
"standard",
",",
"'keystr'",
":",
"key",
",",
"}",
"return",
"self",
".",
"_post",
"(",
"'product/get'",
",",
"data",
"=",
"data",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatScan.list_product | 批量查询商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param offset: 可选,批量查询的起始位置,从 0 开始,包含该起始位置
:param limit: 可选,批量查询的数量,默认为 10
:param status: 可选,支持按状态拉取。on为发布状态,off为未发布状态,
check为审核中状态,reject为审核未通过状态,all为所有状态
:param... | wechatpy/client/api/scan.py | def list_product(self, offset=0, limit=10, status=None, key=None):
"""
批量查询商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param offset: 可选,批量查询的起始位置,从 0 开始,包含该起始位置
:param limit: 可选,批量查询的数量,默认为 10
:param status: 可选,支持按状态拉取。on为发布... | def list_product(self, offset=0, limit=10, status=None, key=None):
"""
批量查询商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param offset: 可选,批量查询的起始位置,从 0 开始,包含该起始位置
:param limit: 可选,批量查询的数量,默认为 10
:param status: 可选,支持按状态拉取。on为发布... | [
"批量查询商品信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/scan.py#L111-L131 | [
"def",
"list_product",
"(",
"self",
",",
"offset",
"=",
"0",
",",
"limit",
"=",
"10",
",",
"status",
"=",
"None",
",",
"key",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
"offset",
"=",
"offset",
",",
"limit",
"=",
"limit",
",",
"status... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatScan.clear_product | 清除商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param standard: 商品编码标准
:param key: 商品编码内容
:return: 返回的 JSON 数据包 | wechatpy/client/api/scan.py | def clear_product(self, standard, key):
"""
清除商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param standard: 商品编码标准
:param key: 商品编码内容
:return: 返回的 JSON 数据包
"""
data = {
'keystandard': standard,
... | def clear_product(self, standard, key):
"""
清除商品信息
详情请参考
http://mp.weixin.qq.com/wiki/15/7fa787701295b884410b5163e13313af.html
:param standard: 商品编码标准
:param key: 商品编码内容
:return: 返回的 JSON 数据包
"""
data = {
'keystandard': standard,
... | [
"清除商品信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/scan.py#L144-L159 | [
"def",
"clear_product",
"(",
"self",
",",
"standard",
",",
"key",
")",
":",
"data",
"=",
"{",
"'keystandard'",
":",
"standard",
",",
"'keystr'",
":",
"key",
",",
"}",
"return",
"self",
".",
"_post",
"(",
"'product/clear'",
",",
"data",
"=",
"data",
")"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDevice.send_message | 主动发送消息给设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-3
:param device_type: 设备类型,目前为“公众账号原始ID”
:param device_id: 设备ID
:param user_id: 微信用户账号的openid
:param content: 消息内容,BASE64编码
:return: 返回的 JSON 数据包 | wechatpy/client/api/device.py | def send_message(self, device_type, device_id, user_id, content):
"""
主动发送消息给设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-3
:param device_type: 设备类型,目前为“公众账号原始ID”
:param device_id: 设备ID
:param user_id: 微信用户账号的openid
:param content: 消息内容... | def send_message(self, device_type, device_id, user_id, content):
"""
主动发送消息给设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-3
:param device_type: 设备类型,目前为“公众账号原始ID”
:param device_id: 设备ID
:param user_id: 微信用户账号的openid
:param content: 消息内容... | [
"主动发送消息给设备",
"详情请参考",
"https",
":",
"//",
"iot",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"new",
"/",
"index",
".",
"html?page",
"=",
"3",
"-",
"4",
"-",
"3"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/device.py#L14-L35 | [
"def",
"send_message",
"(",
"self",
",",
"device_type",
",",
"device_id",
",",
"user_id",
",",
"content",
")",
":",
"content",
"=",
"to_text",
"(",
"base64",
".",
"b64encode",
"(",
"to_binary",
"(",
"content",
")",
")",
")",
"return",
"self",
".",
"_post... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDevice.send_status_message | 第三方主动发送设备状态消息给微信终端
详情请参考
https://iot.weixin.qq.com/wiki/document-2_10.html
:param device_type: 设备类型,目前为“公众账号原始ID”
:param device_id: 设备ID
:param user_id: 微信用户账号的openid
:param msg_type: 消息类型:2--设备状态消息
:param status: 设备状态:0--未连接, 1--已连接
:return: 返回的 JSON 数据包 | wechatpy/client/api/device.py | def send_status_message(self, device_type, device_id, user_id, msg_type, device_status):
"""
第三方主动发送设备状态消息给微信终端
详情请参考
https://iot.weixin.qq.com/wiki/document-2_10.html
:param device_type: 设备类型,目前为“公众账号原始ID”
:param device_id: 设备ID
:param user_id: 微信用户账号的openid
... | def send_status_message(self, device_type, device_id, user_id, msg_type, device_status):
"""
第三方主动发送设备状态消息给微信终端
详情请参考
https://iot.weixin.qq.com/wiki/document-2_10.html
:param device_type: 设备类型,目前为“公众账号原始ID”
:param device_id: 设备ID
:param user_id: 微信用户账号的openid
... | [
"第三方主动发送设备状态消息给微信终端",
"详情请参考",
"https",
":",
"//",
"iot",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"document",
"-",
"2_10",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/device.py#L37-L59 | [
"def",
"send_status_message",
"(",
"self",
",",
"device_type",
",",
"device_id",
",",
"user_id",
",",
"msg_type",
",",
"device_status",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'transmsg'",
",",
"data",
"=",
"{",
"'device_type'",
":",
"device_type",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDevice.get_qrcode_url | 通过 ticket 换取二维码地址
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-4
:param ticket: 二维码 ticket
:param data: 额外数据
:return: 二维码地址 | wechatpy/client/api/device.py | def get_qrcode_url(self, ticket, data=None):
"""
通过 ticket 换取二维码地址
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-4
:param ticket: 二维码 ticket
:param data: 额外数据
:return: 二维码地址
"""
url = 'https://we.qq.com/d/{ticket}'.format(ticket=tic... | def get_qrcode_url(self, ticket, data=None):
"""
通过 ticket 换取二维码地址
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-4
:param ticket: 二维码 ticket
:param data: 额外数据
:return: 二维码地址
"""
url = 'https://we.qq.com/d/{ticket}'.format(ticket=tic... | [
"通过",
"ticket",
"换取二维码地址",
"详情请参考",
"https",
":",
"//",
"iot",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"new",
"/",
"index",
".",
"html?page",
"=",
"3",
"-",
"4",
"-",
"4"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/device.py#L78-L94 | [
"def",
"get_qrcode_url",
"(",
"self",
",",
"ticket",
",",
"data",
"=",
"None",
")",
":",
"url",
"=",
"'https://we.qq.com/d/{ticket}'",
".",
"format",
"(",
"ticket",
"=",
"ticket",
")",
"if",
"data",
":",
"if",
"isinstance",
"(",
"data",
",",
"(",
"dict",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDevice.bind | 绑定设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-7
:param ticket: 绑定操作合法性的凭证(由微信后台生成,第三方H5通过客户端jsapi获得)
:param device_id: 设备id
:param user_id: 用户对应的openid
:return: 返回的 JSON 数据包 | wechatpy/client/api/device.py | def bind(self, ticket, device_id, user_id):
"""
绑定设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-7
:param ticket: 绑定操作合法性的凭证(由微信后台生成,第三方H5通过客户端jsapi获得)
:param device_id: 设备id
:param user_id: 用户对应的openid
:return: 返回的 JSON 数据包
"""
... | def bind(self, ticket, device_id, user_id):
"""
绑定设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-7
:param ticket: 绑定操作合法性的凭证(由微信后台生成,第三方H5通过客户端jsapi获得)
:param device_id: 设备id
:param user_id: 用户对应的openid
:return: 返回的 JSON 数据包
"""
... | [
"绑定设备",
"详情请参考",
"https",
":",
"//",
"iot",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"new",
"/",
"index",
".",
"html?page",
"=",
"3",
"-",
"4",
"-",
"7"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/device.py#L96-L114 | [
"def",
"bind",
"(",
"self",
",",
"ticket",
",",
"device_id",
",",
"user_id",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'bind'",
",",
"data",
"=",
"{",
"'ticket'",
":",
"ticket",
",",
"'device_id'",
":",
"device_id",
",",
"'openid'",
":",
"user_id... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDevice.unbind | 解绑设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-7
:param ticket: 绑定操作合法性的凭证(由微信后台生成,第三方H5通过客户端jsapi获得)
:param device_id: 设备id
:param user_id: 用户对应的openid
:return: 返回的 JSON 数据包 | wechatpy/client/api/device.py | def unbind(self, ticket, device_id, user_id):
"""
解绑设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-7
:param ticket: 绑定操作合法性的凭证(由微信后台生成,第三方H5通过客户端jsapi获得)
:param device_id: 设备id
:param user_id: 用户对应的openid
:return: 返回的 JSON 数据包
"""... | def unbind(self, ticket, device_id, user_id):
"""
解绑设备
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-7
:param ticket: 绑定操作合法性的凭证(由微信后台生成,第三方H5通过客户端jsapi获得)
:param device_id: 设备id
:param user_id: 用户对应的openid
:return: 返回的 JSON 数据包
"""... | [
"解绑设备",
"详情请参考",
"https",
":",
"//",
"iot",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"new",
"/",
"index",
".",
"html?page",
"=",
"3",
"-",
"4",
"-",
"7"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/device.py#L116-L134 | [
"def",
"unbind",
"(",
"self",
",",
"ticket",
",",
"device_id",
",",
"user_id",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'unbind'",
",",
"data",
"=",
"{",
"'ticket'",
":",
"ticket",
",",
"'device_id'",
":",
"device_id",
",",
"'openid'",
":",
"use... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDevice.get_qrcode | 获取deviceid和二维码
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-4
:param product_id: 设备的产品编号
:return: 返回的 JSON 数据包 | wechatpy/client/api/device.py | def get_qrcode(self, product_id=1):
"""
获取deviceid和二维码
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-4
:param product_id: 设备的产品编号
:return: 返回的 JSON 数据包
"""
if product_id == '1' or product_id == 1:
params = None
else:
... | def get_qrcode(self, product_id=1):
"""
获取deviceid和二维码
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-4
:param product_id: 设备的产品编号
:return: 返回的 JSON 数据包
"""
if product_id == '1' or product_id == 1:
params = None
else:
... | [
"获取deviceid和二维码",
"详情请参考",
"https",
":",
"//",
"iot",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"new",
"/",
"index",
".",
"html?page",
"=",
"3",
"-",
"4",
"-",
"4"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/device.py#L240-L254 | [
"def",
"get_qrcode",
"(",
"self",
",",
"product_id",
"=",
"1",
")",
":",
"if",
"product_id",
"==",
"'1'",
"or",
"product_id",
"==",
"1",
":",
"params",
"=",
"None",
"else",
":",
"params",
"=",
"{",
"'product_id'",
":",
"product_id",
"}",
"return",
"sel... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatDevice.authorize | 设备授权
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-5
:param devices: 设备信息的列表
:param op_type: 请求操作的类型,限定取值为:0:设备授权 1:设备更新
:return: 返回的 JSON 数据包 | wechatpy/client/api/device.py | def authorize(self, devices, op_type=1):
"""
设备授权
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-5
:param devices: 设备信息的列表
:param op_type: 请求操作的类型,限定取值为:0:设备授权 1:设备更新
:return: 返回的 JSON 数据包
"""
return self._post(
'authoriz... | def authorize(self, devices, op_type=1):
"""
设备授权
详情请参考
https://iot.weixin.qq.com/wiki/new/index.html?page=3-4-5
:param devices: 设备信息的列表
:param op_type: 请求操作的类型,限定取值为:0:设备授权 1:设备更新
:return: 返回的 JSON 数据包
"""
return self._post(
'authoriz... | [
"设备授权",
"详情请参考",
"https",
":",
"//",
"iot",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"new",
"/",
"index",
".",
"html?page",
"=",
"3",
"-",
"4",
"-",
"5"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/device.py#L256-L273 | [
"def",
"authorize",
"(",
"self",
",",
"devices",
",",
"op_type",
"=",
"1",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'authorize_device'",
",",
"data",
"=",
"{",
"'device_num'",
":",
"len",
"(",
"devices",
")",
",",
"'device_list'",
":",
"devices",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.create | 创建成员
https://work.weixin.qq.com/api/doc#90000/90135/90195 | wechatpy/enterprise/client/api/user.py | def create(self, user_id, name, department=None, position=None,
mobile=None, gender=0, tel=None, email=None,
weixin_id=None, extattr=None):
"""
创建成员
https://work.weixin.qq.com/api/doc#90000/90135/90195
"""
user_data = optionaldict()
user_dat... | def create(self, user_id, name, department=None, position=None,
mobile=None, gender=0, tel=None, email=None,
weixin_id=None, extattr=None):
"""
创建成员
https://work.weixin.qq.com/api/doc#90000/90135/90195
"""
user_data = optionaldict()
user_dat... | [
"创建成员"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/user.py#L18-L41 | [
"def",
"create",
"(",
"self",
",",
"user_id",
",",
"name",
",",
"department",
"=",
"None",
",",
"position",
"=",
"None",
",",
"mobile",
"=",
"None",
",",
"gender",
"=",
"0",
",",
"tel",
"=",
"None",
",",
"email",
"=",
"None",
",",
"weixin_id",
"=",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.list | 批量获取部门成员 / 批量获取部门成员详情
https://work.weixin.qq.com/api/doc#90000/90135/90200
https://work.weixin.qq.com/api/doc#90000/90135/90201
此接口和 `WeChatDepartment.get_users` 是同一个接口,区别为 simple 的默认值不同。 | wechatpy/enterprise/client/api/user.py | def list(self, department_id, fetch_child=False, status=0, simple=False):
"""
批量获取部门成员 / 批量获取部门成员详情
https://work.weixin.qq.com/api/doc#90000/90135/90200
https://work.weixin.qq.com/api/doc#90000/90135/90201
此接口和 `WeChatDepartment.get_users` 是同一个接口,区别为 simple 的默认值不同。
"""
... | def list(self, department_id, fetch_child=False, status=0, simple=False):
"""
批量获取部门成员 / 批量获取部门成员详情
https://work.weixin.qq.com/api/doc#90000/90135/90200
https://work.weixin.qq.com/api/doc#90000/90135/90201
此接口和 `WeChatDepartment.get_users` 是同一个接口,区别为 simple 的默认值不同。
"""
... | [
"批量获取部门成员",
"/",
"批量获取部门成员详情"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/user.py#L108-L126 | [
"def",
"list",
"(",
"self",
",",
"department_id",
",",
"fetch_child",
"=",
"False",
",",
"status",
"=",
"0",
",",
"simple",
"=",
"False",
")",
":",
"url",
"=",
"'user/simplelist'",
"if",
"simple",
"else",
"'user/list'",
"res",
"=",
"self",
".",
"_get",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.convert_to_openid | user_id 转成 openid
https://work.weixin.qq.com/api/doc#90000/90135/90202
:param user_id: 企业微信内的成员 ID
:param agent_id: 可选,需要发送红包的应用ID,若只是使用微信支付和企业转账,则无需该参数
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/user.py | def convert_to_openid(self, user_id, agent_id=None):
"""
user_id 转成 openid
https://work.weixin.qq.com/api/doc#90000/90135/90202
:param user_id: 企业微信内的成员 ID
:param agent_id: 可选,需要发送红包的应用ID,若只是使用微信支付和企业转账,则无需该参数
:return: 返回的 JSON 数据包
"""
data = optionaldic... | def convert_to_openid(self, user_id, agent_id=None):
"""
user_id 转成 openid
https://work.weixin.qq.com/api/doc#90000/90135/90202
:param user_id: 企业微信内的成员 ID
:param agent_id: 可选,需要发送红包的应用ID,若只是使用微信支付和企业转账,则无需该参数
:return: 返回的 JSON 数据包
"""
data = optionaldic... | [
"user_id",
"转成",
"openid"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/user.py#L128-L142 | [
"def",
"convert_to_openid",
"(",
"self",
",",
"user_id",
",",
"agent_id",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
"userid",
"=",
"user_id",
",",
"agentid",
"=",
"agent_id",
")",
"return",
"self",
".",
"_post",
"(",
"'user/convert_to_openid'"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatAppChat.create | 创建群聊会话
详情请参考
https://work.weixin.qq.com/api/doc#90000/90135/90245
限制说明:
只允许企业自建应用调用,且应用的可见范围必须是根部门;
群成员人数不可超过管理端配置的“群成员人数上限”,且最大不可超过500人;
每企业创建群数不可超过1000/天;
:param chat_id: 群聊的唯一标志,不能与已有的群重复;字符串类型,最长32个字符。只允许字符0-9及字母a-zA-Z。如果不填,系统会随机生成群id
:param name: 群... | wechatpy/enterprise/client/api/appchat.py | def create(self, chat_id=None, name=None, owner=None, user_list=None):
"""
创建群聊会话
详情请参考
https://work.weixin.qq.com/api/doc#90000/90135/90245
限制说明:
只允许企业自建应用调用,且应用的可见范围必须是根部门;
群成员人数不可超过管理端配置的“群成员人数上限”,且最大不可超过500人;
每企业创建群数不可超过1000/天;
:param chat_i... | def create(self, chat_id=None, name=None, owner=None, user_list=None):
"""
创建群聊会话
详情请参考
https://work.weixin.qq.com/api/doc#90000/90135/90245
限制说明:
只允许企业自建应用调用,且应用的可见范围必须是根部门;
群成员人数不可超过管理端配置的“群成员人数上限”,且最大不可超过500人;
每企业创建群数不可超过1000/天;
:param chat_i... | [
"创建群聊会话"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/appchat.py#L14-L38 | [
"def",
"create",
"(",
"self",
",",
"chat_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"user_list",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
"chatid",
"=",
"chat_id",
",",
"name",
"=",
"name",
",",
"own... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatAppChat.send | 应用推送消息
详情请参考:https://work.weixin.qq.com/api/doc#90000/90135/90248
:param chat_id: 群聊id
:param msg_type: 消息类型,可以为text/image/voice/video/file/textcard/news/mpnews/markdown
:param kwargs: 具体消息类型的扩展参数
:return: | wechatpy/enterprise/client/api/appchat.py | def send(self, chat_id, msg_type, **kwargs):
"""
应用推送消息
详情请参考:https://work.weixin.qq.com/api/doc#90000/90135/90248
:param chat_id: 群聊id
:param msg_type: 消息类型,可以为text/image/voice/video/file/textcard/news/mpnews/markdown
:param kwargs: 具体消息类型的扩展参数
:return:
... | def send(self, chat_id, msg_type, **kwargs):
"""
应用推送消息
详情请参考:https://work.weixin.qq.com/api/doc#90000/90135/90248
:param chat_id: 群聊id
:param msg_type: 消息类型,可以为text/image/voice/video/file/textcard/news/mpnews/markdown
:param kwargs: 具体消息类型的扩展参数
:return:
... | [
"应用推送消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/appchat.py#L77-L93 | [
"def",
"send",
"(",
"self",
",",
"chat_id",
",",
"msg_type",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"'chatid'",
":",
"chat_id",
",",
"'safe'",
":",
"kwargs",
".",
"get",
"(",
"'safe'",
")",
"or",
"0",
"}",
"data",
".",
"update",
"("... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatAppChat.send_msg | deprecated, use `send` instead | wechatpy/enterprise/client/api/appchat.py | def send_msg(self, chat_id, msg_type, **kwargs):
""" deprecated, use `send` instead """
return self.send(chat_id, msg_type, **kwargs) | def send_msg(self, chat_id, msg_type, **kwargs):
""" deprecated, use `send` instead """
return self.send(chat_id, msg_type, **kwargs) | [
"deprecated",
"use",
"send",
"instead"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/appchat.py#L95-L97 | [
"def",
"send_msg",
"(",
"self",
",",
"chat_id",
",",
"msg_type",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"send",
"(",
"chat_id",
",",
"msg_type",
",",
"*",
"*",
"kwargs",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatAppChat.send_text | 发送文本消息
详情请参考:https://work.weixin.qq.com/api/doc#90000/90135/90248/文本消息/
:param chat_id: 群聊id
:param content: 消息内容
:param safe: 表示是否是保密消息,0表示否,1表示是,默认0
:return: | wechatpy/enterprise/client/api/appchat.py | def send_text(self, chat_id, content, safe=0):
"""
发送文本消息
详情请参考:https://work.weixin.qq.com/api/doc#90000/90135/90248/文本消息/
:param chat_id: 群聊id
:param content: 消息内容
:param safe: 表示是否是保密消息,0表示否,1表示是,默认0
:return:
"""
return self.send(chat_id, 'text... | def send_text(self, chat_id, content, safe=0):
"""
发送文本消息
详情请参考:https://work.weixin.qq.com/api/doc#90000/90135/90248/文本消息/
:param chat_id: 群聊id
:param content: 消息内容
:param safe: 表示是否是保密消息,0表示否,1表示是,默认0
:return:
"""
return self.send(chat_id, 'text... | [
"发送文本消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/appchat.py#L99-L110 | [
"def",
"send_text",
"(",
"self",
",",
"chat_id",
",",
"content",
",",
"safe",
"=",
"0",
")",
":",
"return",
"self",
".",
"send",
"(",
"chat_id",
",",
"'text'",
",",
"safe",
"=",
"safe",
",",
"content",
"=",
"content",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatAppChat._build_msg_content | 构造消息内容
:param content: 消息内容,最长不超过2048个字节
:param msgtype: 消息类型,可以为text/image/voice/video/file/textcard/news/mpnews/markdown
:param kwargs: 具体消息类型的扩展参数
:return: | wechatpy/enterprise/client/api/appchat.py | def _build_msg_content(self, msgtype='text', **kwargs):
"""
构造消息内容
:param content: 消息内容,最长不超过2048个字节
:param msgtype: 消息类型,可以为text/image/voice/video/file/textcard/news/mpnews/markdown
:param kwargs: 具体消息类型的扩展参数
:return:
"""
data = {'msgtype': msgtype}
... | def _build_msg_content(self, msgtype='text', **kwargs):
"""
构造消息内容
:param content: 消息内容,最长不超过2048个字节
:param msgtype: 消息类型,可以为text/image/voice/video/file/textcard/news/mpnews/markdown
:param kwargs: 具体消息类型的扩展参数
:return:
"""
data = {'msgtype': msgtype}
... | [
"构造消息内容"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/appchat.py#L112-L185 | [
"def",
"_build_msg_content",
"(",
"self",
",",
"msgtype",
"=",
"'text'",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"'msgtype'",
":",
"msgtype",
"}",
"if",
"msgtype",
"==",
"'text'",
":",
"data",
"[",
"msgtype",
"]",
"=",
"{",
"'content'",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatQRCode.show | 通过ticket换取二维码
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542
:param ticket: 二维码 ticket 。可以通过 :func:`create` 获取到
:return: 返回的 Request 对象
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appid', 'secret')
... | wechatpy/client/api/qrcode.py | def show(self, ticket):
"""
通过ticket换取二维码
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542
:param ticket: 二维码 ticket 。可以通过 :func:`create` 获取到
:return: 返回的 Request 对象
使用示例::
from wechatpy import WeChatClient
client... | def show(self, ticket):
"""
通过ticket换取二维码
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542
:param ticket: 二维码 ticket 。可以通过 :func:`create` 获取到
:return: 返回的 Request 对象
使用示例::
from wechatpy import WeChatClient
client... | [
"通过ticket换取二维码",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?t",
"=",
"resource",
"/",
"res_main&id",
"=",
"mp1443433542"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/qrcode.py#L46-L70 | [
"def",
"show",
"(",
"self",
",",
"ticket",
")",
":",
"if",
"isinstance",
"(",
"ticket",
",",
"dict",
")",
":",
"ticket",
"=",
"ticket",
"[",
"'ticket'",
"]",
"return",
"requests",
".",
"get",
"(",
"url",
"=",
"'https://mp.weixin.qq.com/cgi-bin/showqrcode'",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatQRCode.get_url | 通过ticket换取二维码地址
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542
:param ticket: 二维码 ticket 。可以通过 :func:`create` 获取到
:return: 返回的二维码地址
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appid', 'secret')
u... | wechatpy/client/api/qrcode.py | def get_url(cls, ticket):
"""
通过ticket换取二维码地址
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542
:param ticket: 二维码 ticket 。可以通过 :func:`create` 获取到
:return: 返回的二维码地址
使用示例::
from wechatpy import WeChatClient
client =... | def get_url(cls, ticket):
"""
通过ticket换取二维码地址
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542
:param ticket: 二维码 ticket 。可以通过 :func:`create` 获取到
:return: 返回的二维码地址
使用示例::
from wechatpy import WeChatClient
client =... | [
"通过ticket换取二维码地址",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?t",
"=",
"resource",
"/",
"res_main&id",
"=",
"mp1443433542"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/qrcode.py#L73-L94 | [
"def",
"get_url",
"(",
"cls",
",",
"ticket",
")",
":",
"url",
"=",
"'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={ticket}'",
"if",
"isinstance",
"(",
"ticket",
",",
"dict",
")",
":",
"ticket",
"=",
"ticket",
"[",
"'ticket'",
"]",
"ticket",
"=",
"six",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | BaseWeChatClient.access_token | WeChat access token | wechatpy/client/base.py | def access_token(self):
""" WeChat access token """
access_token = self.session.get(self.access_token_key)
if access_token:
if not self.expires_at:
# user provided access_token, just return it
return access_token
timestamp = time.time()
... | def access_token(self):
""" WeChat access token """
access_token = self.session.get(self.access_token_key)
if access_token:
if not self.expires_at:
# user provided access_token, just return it
return access_token
timestamp = time.time()
... | [
"WeChat",
"access",
"token"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/base.py#L236-L249 | [
"def",
"access_token",
"(",
"self",
")",
":",
"access_token",
"=",
"self",
".",
"session",
".",
"get",
"(",
"self",
".",
"access_token_key",
")",
"if",
"access_token",
":",
"if",
"not",
"self",
".",
"expires_at",
":",
"# user provided access_token, just return i... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.create | 创建卡券
:param card_data: 卡券信息
:return: 创建的卡券 ID | wechatpy/client/api/card.py | def create(self, card_data):
"""
创建卡券
:param card_data: 卡券信息
:return: 创建的卡券 ID
"""
result = self._post(
'card/create',
data=card_data,
result_processor=lambda x: x['card_id']
)
return result | def create(self, card_data):
"""
创建卡券
:param card_data: 卡券信息
:return: 创建的卡券 ID
"""
result = self._post(
'card/create',
data=card_data,
result_processor=lambda x: x['card_id']
)
return result | [
"创建卡券"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L11-L23 | [
"def",
"create",
"(",
"self",
",",
"card_data",
")",
":",
"result",
"=",
"self",
".",
"_post",
"(",
"'card/create'",
",",
"data",
"=",
"card_data",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"'card_id'",
"]",
")",
"return",
"result"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.batch_add_locations | 批量导入门店信息
:param location_data: 门店信息
:return: 门店 ID 列表,插入失败的门店元素值为 -1 | wechatpy/client/api/card.py | def batch_add_locations(self, location_data):
"""
批量导入门店信息
:param location_data: 门店信息
:return: 门店 ID 列表,插入失败的门店元素值为 -1
"""
result = self._post(
'card/location/batchadd',
data=location_data,
result_processor=lambda x: x['location_id_lis... | def batch_add_locations(self, location_data):
"""
批量导入门店信息
:param location_data: 门店信息
:return: 门店 ID 列表,插入失败的门店元素值为 -1
"""
result = self._post(
'card/location/batchadd',
data=location_data,
result_processor=lambda x: x['location_id_lis... | [
"批量导入门店信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L25-L37 | [
"def",
"batch_add_locations",
"(",
"self",
",",
"location_data",
")",
":",
"result",
"=",
"self",
".",
"_post",
"(",
"'card/location/batchadd'",
",",
"data",
"=",
"location_data",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"'location_id_list'",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.create_qrcode | 创建卡券二维码
:param qrcode_data: 二维码信息
:return: 二维码 ticket,可使用 :func:show_qrcode 换取二维码文件 | wechatpy/client/api/card.py | def create_qrcode(self, qrcode_data):
"""
创建卡券二维码
:param qrcode_data: 二维码信息
:return: 二维码 ticket,可使用 :func:show_qrcode 换取二维码文件
"""
result = self._post(
'card/qrcode/create',
data=qrcode_data,
result_processor=lambda x: x['ticket']
... | def create_qrcode(self, qrcode_data):
"""
创建卡券二维码
:param qrcode_data: 二维码信息
:return: 二维码 ticket,可使用 :func:show_qrcode 换取二维码文件
"""
result = self._post(
'card/qrcode/create',
data=qrcode_data,
result_processor=lambda x: x['ticket']
... | [
"创建卡券二维码"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L62-L74 | [
"def",
"create_qrcode",
"(",
"self",
",",
"qrcode_data",
")",
":",
"result",
"=",
"self",
".",
"_post",
"(",
"'card/qrcode/create'",
",",
"data",
"=",
"qrcode_data",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"'ticket'",
"]",
")",
"return"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.get_html | 图文消息群发卡券 | wechatpy/client/api/card.py | def get_html(self, card_id):
"""
图文消息群发卡券
"""
result = self._post(
'card/mpnews/gethtml',
data={
'card_id': card_id
},
result_processor=lambda x: x['content']
)
return result | def get_html(self, card_id):
"""
图文消息群发卡券
"""
result = self._post(
'card/mpnews/gethtml',
data={
'card_id': card_id
},
result_processor=lambda x: x['content']
)
return result | [
"图文消息群发卡券"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L86-L97 | [
"def",
"get_html",
"(",
"self",
",",
"card_id",
")",
":",
"result",
"=",
"self",
".",
"_post",
"(",
"'card/mpnews/gethtml'",
",",
"data",
"=",
"{",
"'card_id'",
":",
"card_id",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"'content'",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.consume_code | 消耗 code | wechatpy/client/api/card.py | def consume_code(self, code, card_id=None):
"""
消耗 code
"""
card_data = {
'code': code
}
if card_id:
card_data['card_id'] = card_id
return self._post(
'card/code/consume',
data=card_data
) | def consume_code(self, code, card_id=None):
"""
消耗 code
"""
card_data = {
'code': code
}
if card_id:
card_data['card_id'] = card_id
return self._post(
'card/code/consume',
data=card_data
) | [
"消耗",
"code"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L99-L111 | [
"def",
"consume_code",
"(",
"self",
",",
"code",
",",
"card_id",
"=",
"None",
")",
":",
"card_data",
"=",
"{",
"'code'",
":",
"code",
"}",
"if",
"card_id",
":",
"card_data",
"[",
"'card_id'",
"]",
"=",
"card_id",
"return",
"self",
".",
"_post",
"(",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.decrypt_code | 解码加密的 code | wechatpy/client/api/card.py | def decrypt_code(self, encrypt_code):
"""
解码加密的 code
"""
result = self._post(
'card/code/decrypt',
data={
'encrypt_code': encrypt_code
},
result_processor=lambda x: x['code']
)
return result | def decrypt_code(self, encrypt_code):
"""
解码加密的 code
"""
result = self._post(
'card/code/decrypt',
data={
'encrypt_code': encrypt_code
},
result_processor=lambda x: x['code']
)
return result | [
"解码加密的",
"code"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L113-L124 | [
"def",
"decrypt_code",
"(",
"self",
",",
"encrypt_code",
")",
":",
"result",
"=",
"self",
".",
"_post",
"(",
"'card/code/decrypt'",
",",
"data",
"=",
"{",
"'encrypt_code'",
":",
"encrypt_code",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.get_code | 查询 code 信息 | wechatpy/client/api/card.py | def get_code(self, code, card_id=None, check_consume=True):
"""
查询 code 信息
"""
card_data = {
'code': code
}
if card_id:
card_data['card_id'] = card_id
if not check_consume:
card_data['check_consume'] = check_consume
retu... | def get_code(self, code, card_id=None, check_consume=True):
"""
查询 code 信息
"""
card_data = {
'code': code
}
if card_id:
card_data['card_id'] = card_id
if not check_consume:
card_data['check_consume'] = check_consume
retu... | [
"查询",
"code",
"信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L137-L151 | [
"def",
"get_code",
"(",
"self",
",",
"code",
",",
"card_id",
"=",
"None",
",",
"check_consume",
"=",
"True",
")",
":",
"card_data",
"=",
"{",
"'code'",
":",
"code",
"}",
"if",
"card_id",
":",
"card_data",
"[",
"'card_id'",
"]",
"=",
"card_id",
"if",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.get_card_list | 用于获取用户卡包里的,属于该appid下的卡券。 | wechatpy/client/api/card.py | def get_card_list(self, openid, card_id=None):
"""
用于获取用户卡包里的,属于该appid下的卡券。
"""
card_data = {
'openid': openid
}
if card_id:
card_data['card_id'] = card_id
return self._post(
'card/user/getcardlist',
data=card_data
... | def get_card_list(self, openid, card_id=None):
"""
用于获取用户卡包里的,属于该appid下的卡券。
"""
card_data = {
'openid': openid
}
if card_id:
card_data['card_id'] = card_id
return self._post(
'card/user/getcardlist',
data=card_data
... | [
"用于获取用户卡包里的,属于该appid下的卡券。"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L153-L165 | [
"def",
"get_card_list",
"(",
"self",
",",
"openid",
",",
"card_id",
"=",
"None",
")",
":",
"card_data",
"=",
"{",
"'openid'",
":",
"openid",
"}",
"if",
"card_id",
":",
"card_data",
"[",
"'card_id'",
"]",
"=",
"card_id",
"return",
"self",
".",
"_post",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.batch_get | 批量查询卡券信息 | wechatpy/client/api/card.py | def batch_get(self, offset=0, count=50, status_list=None):
"""
批量查询卡券信息
"""
card_data = {
'offset': offset,
'count': count
}
if status_list:
card_data['status_list'] = status_list
return self._post(
'card/batchget',
... | def batch_get(self, offset=0, count=50, status_list=None):
"""
批量查询卡券信息
"""
card_data = {
'offset': offset,
'count': count
}
if status_list:
card_data['status_list'] = status_list
return self._post(
'card/batchget',
... | [
"批量查询卡券信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L167-L180 | [
"def",
"batch_get",
"(",
"self",
",",
"offset",
"=",
"0",
",",
"count",
"=",
"50",
",",
"status_list",
"=",
"None",
")",
":",
"card_data",
"=",
"{",
"'offset'",
":",
"offset",
",",
"'count'",
":",
"count",
"}",
"if",
"status_list",
":",
"card_data",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCard.get | 查询卡券详情 | wechatpy/client/api/card.py | def get(self, card_id):
"""
查询卡券详情
"""
result = self._post(
'card/get',
data={
'card_id': card_id
},
result_processor=lambda x: x['card']
)
return result | def get(self, card_id):
"""
查询卡券详情
"""
result = self._post(
'card/get',
data={
'card_id': card_id
},
result_processor=lambda x: x['card']
)
return result | [
"查询卡券详情"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L182-L193 | [
"def",
"get",
"(",
"self",
",",
"card_id",
")",
":",
"result",
"=",
"self",
".",
"_post",
"(",
"'card/get'",
",",
"data",
"=",
"{",
"'card_id'",
":",
"card_id",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"'card'",
"]",
")",
"r... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.