repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pycontribs/jira | jira/client.py | JIRA.removed_issues | def removed_issues(self, board_id, sprint_id):
"""Return the completed issues for the sprint."""
r_json = self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)
issues = [Issue(self._options, self._... | python | def removed_issues(self, board_id, sprint_id):
"""Return the completed issues for the sprint."""
r_json = self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)
issues = [Issue(self._options, self._... | [
"def",
"removed_issues",
"(",
"self",
",",
"board_id",
",",
"sprint_id",
")",
":",
"r_json",
"=",
"self",
".",
"_get_json",
"(",
"'rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s'",
"%",
"(",
"board_id",
",",
"sprint_id",
")",
",",
"base",
"=",
"self",
".",... | Return the completed issues for the sprint. | [
"Return",
"the",
"completed",
"issues",
"for",
"the",
"sprint",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3738-L3745 | train | Return the completed issues for the sprint. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.removedIssuesEstimateSum | def removedIssuesEstimateSum(self, board_id, sprint_id):
"""Return the total incompleted points this sprint."""
return self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)['contents']['puntedIssuesEstimateS... | python | def removedIssuesEstimateSum(self, board_id, sprint_id):
"""Return the total incompleted points this sprint."""
return self._get_json('rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s' % (board_id, sprint_id),
base=self.AGILE_BASE_URL)['contents']['puntedIssuesEstimateS... | [
"def",
"removedIssuesEstimateSum",
"(",
"self",
",",
"board_id",
",",
"sprint_id",
")",
":",
"return",
"self",
".",
"_get_json",
"(",
"'rapid/charts/sprintreport?rapidViewId=%s&sprintId=%s'",
"%",
"(",
"board_id",
",",
"sprint_id",
")",
",",
"base",
"=",
"self",
"... | Return the total incompleted points this sprint. | [
"Return",
"the",
"total",
"incompleted",
"points",
"this",
"sprint",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3747-L3750 | train | Return the total incompleted points this sprint. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.sprint_info | def sprint_info(self, board_id, sprint_id):
"""Return the information about a sprint.
:param board_id: the board retrieving issues from. Deprecated and ignored.
:param sprint_id: the sprint retrieving issues from
"""
sprint = Sprint(self._options, self._session)
sprint.f... | python | def sprint_info(self, board_id, sprint_id):
"""Return the information about a sprint.
:param board_id: the board retrieving issues from. Deprecated and ignored.
:param sprint_id: the sprint retrieving issues from
"""
sprint = Sprint(self._options, self._session)
sprint.f... | [
"def",
"sprint_info",
"(",
"self",
",",
"board_id",
",",
"sprint_id",
")",
":",
"sprint",
"=",
"Sprint",
"(",
"self",
".",
"_options",
",",
"self",
".",
"_session",
")",
"sprint",
".",
"find",
"(",
"sprint_id",
")",
"return",
"sprint",
".",
"raw"
] | Return the information about a sprint.
:param board_id: the board retrieving issues from. Deprecated and ignored.
:param sprint_id: the sprint retrieving issues from | [
"Return",
"the",
"information",
"about",
"a",
"sprint",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3753-L3761 | train | Return the information about a sprint. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.sprint | def sprint(self, id):
"""Return the information about a sprint.
:param sprint_id: the sprint retrieving issues from
:type sprint_id: int
:rtype: :class:`~jira.resources.Sprint`
"""
sprint = Sprint(self._options, self._session)
sprint.find(id)
return spr... | python | def sprint(self, id):
"""Return the information about a sprint.
:param sprint_id: the sprint retrieving issues from
:type sprint_id: int
:rtype: :class:`~jira.resources.Sprint`
"""
sprint = Sprint(self._options, self._session)
sprint.find(id)
return spr... | [
"def",
"sprint",
"(",
"self",
",",
"id",
")",
":",
"sprint",
"=",
"Sprint",
"(",
"self",
".",
"_options",
",",
"self",
".",
"_session",
")",
"sprint",
".",
"find",
"(",
"id",
")",
"return",
"sprint"
] | Return the information about a sprint.
:param sprint_id: the sprint retrieving issues from
:type sprint_id: int
:rtype: :class:`~jira.resources.Sprint` | [
"Return",
"the",
"information",
"about",
"a",
"sprint",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3763-L3774 | train | Return the information about a sprint. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.delete_board | def delete_board(self, id):
"""Delete an agile board."""
board = Board(self._options, self._session, raw={'id': id})
board.delete() | python | def delete_board(self, id):
"""Delete an agile board."""
board = Board(self._options, self._session, raw={'id': id})
board.delete() | [
"def",
"delete_board",
"(",
"self",
",",
"id",
")",
":",
"board",
"=",
"Board",
"(",
"self",
".",
"_options",
",",
"self",
".",
"_session",
",",
"raw",
"=",
"{",
"'id'",
":",
"id",
"}",
")",
"board",
".",
"delete",
"(",
")"
] | Delete an agile board. | [
"Delete",
"an",
"agile",
"board",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3777-L3780 | train | Delete an agile board. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.create_board | def create_board(self, name, project_ids, preset="scrum",
location_type='user', location_id=None):
"""Create a new board for the ``project_ids``.
:param name: name of the board
:type name: str
:param project_ids: the projects to create the board in
:type pro... | python | def create_board(self, name, project_ids, preset="scrum",
location_type='user', location_id=None):
"""Create a new board for the ``project_ids``.
:param name: name of the board
:type name: str
:param project_ids: the projects to create the board in
:type pro... | [
"def",
"create_board",
"(",
"self",
",",
"name",
",",
"project_ids",
",",
"preset",
"=",
"\"scrum\"",
",",
"location_type",
"=",
"'user'",
",",
"location_id",
"=",
"None",
")",
":",
"if",
"self",
".",
"_options",
"[",
"'agile_rest_path'",
"]",
"!=",
"Green... | Create a new board for the ``project_ids``.
:param name: name of the board
:type name: str
:param project_ids: the projects to create the board in
:type project_ids: str
:param preset: What preset to use for this board. (Default: "scrum")
:type preset: 'kanban', 'scrum',... | [
"Create",
"a",
"new",
"board",
"for",
"the",
"project_ids",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3782-L3826 | train | Creates a new board for the given project_ids. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.create_sprint | def create_sprint(self, name, board_id, startDate=None, endDate=None):
"""Create a new sprint for the ``board_id``.
:param name: Name of the sprint
:type name: str
:param board_id: Which board the sprint should be assigned.
:type board_id: int
:param startDate: Start dat... | python | def create_sprint(self, name, board_id, startDate=None, endDate=None):
"""Create a new sprint for the ``board_id``.
:param name: Name of the sprint
:type name: str
:param board_id: Which board the sprint should be assigned.
:type board_id: int
:param startDate: Start dat... | [
"def",
"create_sprint",
"(",
"self",
",",
"name",
",",
"board_id",
",",
"startDate",
"=",
"None",
",",
"endDate",
"=",
"None",
")",
":",
"payload",
"=",
"{",
"'name'",
":",
"name",
"}",
"if",
"startDate",
":",
"payload",
"[",
"\"startDate\"",
"]",
"=",... | Create a new sprint for the ``board_id``.
:param name: Name of the sprint
:type name: str
:param board_id: Which board the sprint should be assigned.
:type board_id: int
:param startDate: Start date for the sprint.
:type startDate: Optional[Any]
:param endDate: E... | [
"Create",
"a",
"new",
"sprint",
"for",
"the",
"board_id",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3828-L3876 | train | Creates a new sprint for the given board. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.add_issues_to_sprint | def add_issues_to_sprint(self, sprint_id, issue_keys):
"""Add the issues in ``issue_keys`` to the ``sprint_id``.
The sprint must be started but not completed.
If a sprint was completed, then have to also edit the history of the
issue so that it was added to the sprint before it was com... | python | def add_issues_to_sprint(self, sprint_id, issue_keys):
"""Add the issues in ``issue_keys`` to the ``sprint_id``.
The sprint must be started but not completed.
If a sprint was completed, then have to also edit the history of the
issue so that it was added to the sprint before it was com... | [
"def",
"add_issues_to_sprint",
"(",
"self",
",",
"sprint_id",
",",
"issue_keys",
")",
":",
"if",
"self",
".",
"_options",
"[",
"'agile_rest_path'",
"]",
"==",
"GreenHopperResource",
".",
"AGILE_BASE_REST_PATH",
":",
"url",
"=",
"self",
".",
"_get_url",
"(",
"'... | Add the issues in ``issue_keys`` to the ``sprint_id``.
The sprint must be started but not completed.
If a sprint was completed, then have to also edit the history of the
issue so that it was added to the sprint before it was completed,
preferably before it started. A completed sprint's... | [
"Add",
"the",
"issues",
"in",
"issue_keys",
"to",
"the",
"sprint_id",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3878-L3921 | train | Adds the issues in issue_keys to the sprint. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.add_issues_to_epic | def add_issues_to_epic(self, epic_id, issue_keys, ignore_epics=True):
"""Add the issues in ``issue_keys`` to the ``epic_id``.
:param epic_id: The ID for the epic where issues should be added.
:type epic_id: int
:param issue_keys: The issues to add to the epic
:type issue_keys: s... | python | def add_issues_to_epic(self, epic_id, issue_keys, ignore_epics=True):
"""Add the issues in ``issue_keys`` to the ``epic_id``.
:param epic_id: The ID for the epic where issues should be added.
:type epic_id: int
:param issue_keys: The issues to add to the epic
:type issue_keys: s... | [
"def",
"add_issues_to_epic",
"(",
"self",
",",
"epic_id",
",",
"issue_keys",
",",
"ignore_epics",
"=",
"True",
")",
":",
"if",
"self",
".",
"_options",
"[",
"'agile_rest_path'",
"]",
"!=",
"GreenHopperResource",
".",
"GREENHOPPER_REST_PATH",
":",
"# TODO(ssbarnea)... | Add the issues in ``issue_keys`` to the ``epic_id``.
:param epic_id: The ID for the epic where issues should be added.
:type epic_id: int
:param issue_keys: The issues to add to the epic
:type issue_keys: str
:param ignore_epics: ignore any issues listed in ``issue_keys`` that a... | [
"Add",
"the",
"issues",
"in",
"issue_keys",
"to",
"the",
"epic_id",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3923-L3944 | train | Add the issues in issue_keys to the epic_id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/client.py | JIRA.rank | def rank(self, issue, next_issue):
"""Rank an issue before another using the default Ranking field, the one named 'Rank'.
:param issue: issue key of the issue to be ranked before the second one.
:param next_issue: issue key of the second issue.
"""
if not self._rank:
... | python | def rank(self, issue, next_issue):
"""Rank an issue before another using the default Ranking field, the one named 'Rank'.
:param issue: issue key of the issue to be ranked before the second one.
:param next_issue: issue key of the second issue.
"""
if not self._rank:
... | [
"def",
"rank",
"(",
"self",
",",
"issue",
",",
"next_issue",
")",
":",
"if",
"not",
"self",
".",
"_rank",
":",
"for",
"field",
"in",
"self",
".",
"fields",
"(",
")",
":",
"if",
"field",
"[",
"'name'",
"]",
"==",
"'Rank'",
":",
"if",
"field",
"[",... | Rank an issue before another using the default Ranking field, the one named 'Rank'.
:param issue: issue key of the issue to be ranked before the second one.
:param next_issue: issue key of the second issue. | [
"Rank",
"an",
"issue",
"before",
"another",
"using",
"the",
"default",
"Ranking",
"field",
"the",
"one",
"named",
"Rank",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/client.py#L3947-L3980 | train | Rank an issue before another using the default Ranking field. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | dict2resource | def dict2resource(raw, top=None, options=None, session=None):
"""Convert a dictionary into a Jira Resource object.
Recursively walks a dict structure, transforming the properties into attributes
on a new ``Resource`` object of the appropriate type (if a ``self`` link is present)
or a ``PropertyHolder``... | python | def dict2resource(raw, top=None, options=None, session=None):
"""Convert a dictionary into a Jira Resource object.
Recursively walks a dict structure, transforming the properties into attributes
on a new ``Resource`` object of the appropriate type (if a ``self`` link is present)
or a ``PropertyHolder``... | [
"def",
"dict2resource",
"(",
"raw",
",",
"top",
"=",
"None",
",",
"options",
"=",
"None",
",",
"session",
"=",
"None",
")",
":",
"if",
"top",
"is",
"None",
":",
"top",
"=",
"PropertyHolder",
"(",
"raw",
")",
"seqs",
"=",
"tuple",
",",
"list",
",",
... | Convert a dictionary into a Jira Resource object.
Recursively walks a dict structure, transforming the properties into attributes
on a new ``Resource`` object of the appropriate type (if a ``self`` link is present)
or a ``PropertyHolder`` object (if no ``self`` link is present). | [
"Convert",
"a",
"dictionary",
"into",
"a",
"Jira",
"Resource",
"object",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L995-L1032 | train | Convert a dictionary into a Jira Resource object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Resource.find | def find(self,
id,
params=None,
):
"""Finds a resource based on the input parameters.
:type id: Union[Tuple[str, str], int, str]
:type params: Optional[Dict[str, str]]
"""
if params is None:
params = {}
if isinstance(... | python | def find(self,
id,
params=None,
):
"""Finds a resource based on the input parameters.
:type id: Union[Tuple[str, str], int, str]
:type params: Optional[Dict[str, str]]
"""
if params is None:
params = {}
if isinstance(... | [
"def",
"find",
"(",
"self",
",",
"id",
",",
"params",
"=",
"None",
",",
")",
":",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"id",
",",
"tuple",
")",
":",
"path",
"=",
"self",
".",
"_resource",
".",
"fo... | Finds a resource based on the input parameters.
:type id: Union[Tuple[str, str], int, str]
:type params: Optional[Dict[str, str]] | [
"Finds",
"a",
"resource",
"based",
"on",
"the",
"input",
"parameters",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L218-L237 | train | Finds a resource based on the input parameters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Resource._get_url | def _get_url(self, path):
""" Gets the url for the specified path.
:type path: str
:rtype: str
"""
options = self._options.copy()
options.update({'path': path})
return self._base_url.format(**options) | python | def _get_url(self, path):
""" Gets the url for the specified path.
:type path: str
:rtype: str
"""
options = self._options.copy()
options.update({'path': path})
return self._base_url.format(**options) | [
"def",
"_get_url",
"(",
"self",
",",
"path",
")",
":",
"options",
"=",
"self",
".",
"_options",
".",
"copy",
"(",
")",
"options",
".",
"update",
"(",
"{",
"'path'",
":",
"path",
"}",
")",
"return",
"self",
".",
"_base_url",
".",
"format",
"(",
"*",... | Gets the url for the specified path.
:type path: str
:rtype: str | [
"Gets",
"the",
"url",
"for",
"the",
"specified",
"path",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L239-L249 | train | Gets the url for the specified path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Resource.update | def update(self, fields=None, async_=None, jira=None, notify=True, **kwargs):
"""Update this resource on the server.
Keyword arguments are marshalled into a dict before being sent. If this
resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this m... | python | def update(self, fields=None, async_=None, jira=None, notify=True, **kwargs):
"""Update this resource on the server.
Keyword arguments are marshalled into a dict before being sent. If this
resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this m... | [
"def",
"update",
"(",
"self",
",",
"fields",
"=",
"None",
",",
"async_",
"=",
"None",
",",
"jira",
"=",
"None",
",",
"notify",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"async_",
"is",
"None",
":",
"async_",
"=",
"self",
".",
"_option... | Update this resource on the server.
Keyword arguments are marshalled into a dict before being sent. If this
resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this method
will only raise errors in case of user error.
:param fields: Field... | [
"Update",
"this",
"resource",
"on",
"the",
"server",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L251-L347 | train | Update the resource s attributes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Resource.delete | def delete(self, params=None):
"""Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case of user error.
... | python | def delete(self, params=None):
"""Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case of user error.
... | [
"def",
"delete",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"if",
"self",
".",
"_options",
"[",
"'async'",
"]",
":",
"if",
"not",
"hasattr",
"(",
"self",
".",
"_session",
",",
"'_async_jobs'",
")",
":",
"self",
".",
"_session",
".",
"_async_j... | Delete this resource from the server, passing the specified query parameters.
If this resource doesn't support ``DELETE``, a :py:exc:`.JIRAError`
will be raised; subclasses that specialize this method will only raise errors
in case of user error.
:param params: Parameters for the delet... | [
"Delete",
"this",
"resource",
"from",
"the",
"server",
"passing",
"the",
"specified",
"query",
"parameters",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L349-L367 | train | Delete this resource from the server passing the specified query parameters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Resource._load | def _load(self,
url,
headers=CaseInsensitiveDict(),
params=None,
path=None,
):
""" Load a resource.
:type url: str
:type headers: CaseInsensitiveDict
:type params: Optional[Dict[str,str]]
:type path: Optional[... | python | def _load(self,
url,
headers=CaseInsensitiveDict(),
params=None,
path=None,
):
""" Load a resource.
:type url: str
:type headers: CaseInsensitiveDict
:type params: Optional[Dict[str,str]]
:type path: Optional[... | [
"def",
"_load",
"(",
"self",
",",
"url",
",",
"headers",
"=",
"CaseInsensitiveDict",
"(",
")",
",",
"params",
"=",
"None",
",",
"path",
"=",
"None",
",",
")",
":",
"r",
"=",
"self",
".",
"_session",
".",
"get",
"(",
"url",
",",
"headers",
"=",
"h... | Load a resource.
:type url: str
:type headers: CaseInsensitiveDict
:type params: Optional[Dict[str,str]]
:type path: Optional[str] | [
"Load",
"a",
"resource",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L369-L391 | train | Load a resource from the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Resource._parse_raw | def _parse_raw(self, raw):
"""Parse a raw dictionary to create a resource.
:type raw: Dict[str, Any]
"""
self.raw = raw
if not raw:
raise NotImplementedError("We cannot instantiate empty resources: %s" % raw)
dict2resource(raw, self, self._options, self._sess... | python | def _parse_raw(self, raw):
"""Parse a raw dictionary to create a resource.
:type raw: Dict[str, Any]
"""
self.raw = raw
if not raw:
raise NotImplementedError("We cannot instantiate empty resources: %s" % raw)
dict2resource(raw, self, self._options, self._sess... | [
"def",
"_parse_raw",
"(",
"self",
",",
"raw",
")",
":",
"self",
".",
"raw",
"=",
"raw",
"if",
"not",
"raw",
":",
"raise",
"NotImplementedError",
"(",
"\"We cannot instantiate empty resources: %s\"",
"%",
"raw",
")",
"dict2resource",
"(",
"raw",
",",
"self",
... | Parse a raw dictionary to create a resource.
:type raw: Dict[str, Any] | [
"Parse",
"a",
"raw",
"dictionary",
"to",
"create",
"a",
"resource",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L393-L401 | train | Parse a raw dictionary to create a resource. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Attachment.get | def get(self):
"""Return the file content as a string."""
r = self._session.get(self.content, headers={'Accept': '*/*'})
return r.content | python | def get(self):
"""Return the file content as a string."""
r = self._session.get(self.content, headers={'Accept': '*/*'})
return r.content | [
"def",
"get",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"_session",
".",
"get",
"(",
"self",
".",
"content",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'*/*'",
"}",
")",
"return",
"r",
".",
"content"
] | Return the file content as a string. | [
"Return",
"the",
"file",
"content",
"as",
"a",
"string",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L417-L420 | train | Return the file content as a string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Attachment.iter_content | def iter_content(self, chunk_size=1024):
"""Return the file content as an iterable stream."""
r = self._session.get(self.content, stream=True)
return r.iter_content(chunk_size) | python | def iter_content(self, chunk_size=1024):
"""Return the file content as an iterable stream."""
r = self._session.get(self.content, stream=True)
return r.iter_content(chunk_size) | [
"def",
"iter_content",
"(",
"self",
",",
"chunk_size",
"=",
"1024",
")",
":",
"r",
"=",
"self",
".",
"_session",
".",
"get",
"(",
"self",
".",
"content",
",",
"stream",
"=",
"True",
")",
"return",
"r",
".",
"iter_content",
"(",
"chunk_size",
")"
] | Return the file content as an iterable stream. | [
"Return",
"the",
"file",
"content",
"as",
"an",
"iterable",
"stream",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L422-L425 | train | Return the file content as an iterable stream. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Component.delete | def delete(self, moveIssuesTo=None):
"""Delete this component from the server.
:param moveIssuesTo: the name of the component to which to move any issues this component is applied
"""
params = {}
if moveIssuesTo is not None:
params['moveIssuesTo'] = moveIssuesTo
... | python | def delete(self, moveIssuesTo=None):
"""Delete this component from the server.
:param moveIssuesTo: the name of the component to which to move any issues this component is applied
"""
params = {}
if moveIssuesTo is not None:
params['moveIssuesTo'] = moveIssuesTo
... | [
"def",
"delete",
"(",
"self",
",",
"moveIssuesTo",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"moveIssuesTo",
"is",
"not",
"None",
":",
"params",
"[",
"'moveIssuesTo'",
"]",
"=",
"moveIssuesTo",
"super",
"(",
"Component",
",",
"self",
")",
"... | Delete this component from the server.
:param moveIssuesTo: the name of the component to which to move any issues this component is applied | [
"Delete",
"this",
"component",
"from",
"the",
"server",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L436-L445 | train | Delete this component from the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Issue.update | def update(self, fields=None, update=None, async_=None, jira=None, notify=True, **fieldargs):
"""Update this issue on the server.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the ... | python | def update(self, fields=None, update=None, async_=None, jira=None, notify=True, **fieldargs):
"""Update this issue on the server.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the ... | [
"def",
"update",
"(",
"self",
",",
"fields",
"=",
"None",
",",
"update",
"=",
"None",
",",
"async_",
"=",
"None",
",",
"jira",
"=",
"None",
",",
"notify",
"=",
"True",
",",
"*",
"*",
"fieldargs",
")",
":",
"data",
"=",
"{",
"}",
"if",
"fields",
... | Update this issue on the server.
Each keyword argument (other than the predefined ones) is treated as a field name and the argument's value
is treated as the intended value for that field -- if the fields argument is used, all other keyword arguments
will be ignored.
JIRA projects may ... | [
"Update",
"this",
"issue",
"on",
"the",
"server",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L506-L559 | train | Update this issue on the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Issue.add_field_value | def add_field_value(self, field, value):
"""Add a value to a field that supports multiple values, without resetting the existing values.
This should work with: labels, multiple checkbox lists, multiple select
:param field: The field name
:param value: The field's value
:type f... | python | def add_field_value(self, field, value):
"""Add a value to a field that supports multiple values, without resetting the existing values.
This should work with: labels, multiple checkbox lists, multiple select
:param field: The field name
:param value: The field's value
:type f... | [
"def",
"add_field_value",
"(",
"self",
",",
"field",
",",
"value",
")",
":",
"super",
"(",
"Issue",
",",
"self",
")",
".",
"update",
"(",
"fields",
"=",
"{",
"\"update\"",
":",
"{",
"field",
":",
"[",
"{",
"\"add\"",
":",
"value",
"}",
"]",
"}",
... | Add a value to a field that supports multiple values, without resetting the existing values.
This should work with: labels, multiple checkbox lists, multiple select
:param field: The field name
:param value: The field's value
:type field: str | [
"Add",
"a",
"value",
"to",
"a",
"field",
"that",
"supports",
"multiple",
"values",
"without",
"resetting",
"the",
"existing",
"values",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L561-L571 | train | Add a value to a field that supports multiple values without resetting the existing values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Issue.delete | def delete(self, deleteSubtasks=False):
"""Delete this issue from the server.
:param deleteSubtasks: if the issue has subtasks, this argument must be set to true for the call to succeed.
:type deleteSubtasks: bool
"""
super(Issue, self).delete(params={'deleteSubtasks': deleteSu... | python | def delete(self, deleteSubtasks=False):
"""Delete this issue from the server.
:param deleteSubtasks: if the issue has subtasks, this argument must be set to true for the call to succeed.
:type deleteSubtasks: bool
"""
super(Issue, self).delete(params={'deleteSubtasks': deleteSu... | [
"def",
"delete",
"(",
"self",
",",
"deleteSubtasks",
"=",
"False",
")",
":",
"super",
"(",
"Issue",
",",
"self",
")",
".",
"delete",
"(",
"params",
"=",
"{",
"'deleteSubtasks'",
":",
"deleteSubtasks",
"}",
")"
] | Delete this issue from the server.
:param deleteSubtasks: if the issue has subtasks, this argument must be set to true for the call to succeed.
:type deleteSubtasks: bool | [
"Delete",
"this",
"issue",
"from",
"the",
"server",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L573-L580 | train | Delete this issue from the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | RemoteLink.update | def update(self, object, globalId=None, application=None, relationship=None):
"""Update a RemoteLink. 'object' is required.
For definitions of the allowable fields for 'object' and the keyword arguments 'globalId', 'application' and
'relationship', see https://developer.atlassian.com/display/JI... | python | def update(self, object, globalId=None, application=None, relationship=None):
"""Update a RemoteLink. 'object' is required.
For definitions of the allowable fields for 'object' and the keyword arguments 'globalId', 'application' and
'relationship', see https://developer.atlassian.com/display/JI... | [
"def",
"update",
"(",
"self",
",",
"object",
",",
"globalId",
"=",
"None",
",",
"application",
"=",
"None",
",",
"relationship",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'object'",
":",
"object",
"}",
"if",
"globalId",
"is",
"not",
"None",
":",
"dat... | Update a RemoteLink. 'object' is required.
For definitions of the allowable fields for 'object' and the keyword arguments 'globalId', 'application' and
'relationship', see https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+for+Remote+Issue+Links.
:param object: the link details to a... | [
"Update",
"a",
"RemoteLink",
".",
"object",
"is",
"required",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L621-L641 | train | Update a RemoteLink. object is required. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Worklog.delete | def delete(self, adjustEstimate=None, newEstimate=None, increaseBy=None):
"""Delete this worklog entry from its associated issue.
:param adjustEstimate: one of ``new``, ``leave``, ``manual`` or ``auto``.
``auto`` is the default and adjusts the estimate automatically.
``leave`` l... | python | def delete(self, adjustEstimate=None, newEstimate=None, increaseBy=None):
"""Delete this worklog entry from its associated issue.
:param adjustEstimate: one of ``new``, ``leave``, ``manual`` or ``auto``.
``auto`` is the default and adjusts the estimate automatically.
``leave`` l... | [
"def",
"delete",
"(",
"self",
",",
"adjustEstimate",
"=",
"None",
",",
"newEstimate",
"=",
"None",
",",
"increaseBy",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"adjustEstimate",
"is",
"not",
"None",
":",
"params",
"[",
"'adjustEstimate'",
"]"... | Delete this worklog entry from its associated issue.
:param adjustEstimate: one of ``new``, ``leave``, ``manual`` or ``auto``.
``auto`` is the default and adjusts the estimate automatically.
``leave`` leaves the estimate unchanged by this deletion.
:param newEstimate: combined w... | [
"Delete",
"this",
"worklog",
"entry",
"from",
"its",
"associated",
"issue",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L682-L699 | train | Delete this worklog entry from its associated issue. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Role.update | def update(self, users=None, groups=None):
"""Add the specified users or groups to this project role. One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add to the role... | python | def update(self, users=None, groups=None):
"""Add the specified users or groups to this project role. One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add to the role... | [
"def",
"update",
"(",
"self",
",",
"users",
"=",
"None",
",",
"groups",
"=",
"None",
")",
":",
"if",
"users",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"users",
",",
"string_types",
")",
":",
"users",
"=",
"(",
"users",
",",
")",
"if",
"groups... | Add the specified users or groups to this project role. One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add to the role
:type groups: string, list or tuple | [
"Add",
"the",
"specified",
"users",
"or",
"groups",
"to",
"this",
"project",
"role",
".",
"One",
"of",
"users",
"or",
"groups",
"must",
"be",
"specified",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L755-L775 | train | Update the role with the specified users or groups. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Role.add_user | def add_user(self, users=None, groups=None):
"""Add the specified users or groups to this project role.
One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add ... | python | def add_user(self, users=None, groups=None):
"""Add the specified users or groups to this project role.
One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add ... | [
"def",
"add_user",
"(",
"self",
",",
"users",
"=",
"None",
",",
"groups",
"=",
"None",
")",
":",
"if",
"users",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"users",
",",
"string_types",
")",
":",
"users",
"=",
"(",
"users",
",",
")",
"if",
"grou... | Add the specified users or groups to this project role.
One of ``users`` or ``groups`` must be specified.
:param users: a user or users to add to the role
:type users: string, list or tuple
:param groups: a group or groups to add to the role
:type groups: string, list or tuple | [
"Add",
"the",
"specified",
"users",
"or",
"groups",
"to",
"this",
"project",
"role",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L777-L795 | train | Add the specified users or groups to this project role. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Version.delete | def delete(self, moveFixIssuesTo=None, moveAffectedIssuesTo=None):
"""Delete this project version from the server.
If neither of the arguments are specified, the version is
removed from all issues it is attached to.
:param moveFixIssuesTo: in issues for which this version is a fix
... | python | def delete(self, moveFixIssuesTo=None, moveAffectedIssuesTo=None):
"""Delete this project version from the server.
If neither of the arguments are specified, the version is
removed from all issues it is attached to.
:param moveFixIssuesTo: in issues for which this version is a fix
... | [
"def",
"delete",
"(",
"self",
",",
"moveFixIssuesTo",
"=",
"None",
",",
"moveAffectedIssuesTo",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"moveFixIssuesTo",
"is",
"not",
"None",
":",
"params",
"[",
"'moveFixIssuesTo'",
"]",
"=",
"moveFixIssuesTo"... | Delete this project version from the server.
If neither of the arguments are specified, the version is
removed from all issues it is attached to.
:param moveFixIssuesTo: in issues for which this version is a fix
version, add this argument version to the fix version list
... | [
"Delete",
"this",
"project",
"version",
"from",
"the",
"server",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L876-L894 | train | Delete this project version from the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/resources.py | Version.update | def update(self, **args):
"""Update this project version from the server. It is prior used to archive versions."""
data = {}
for field in args:
data[field] = args[field]
super(Version, self).update(**data) | python | def update(self, **args):
"""Update this project version from the server. It is prior used to archive versions."""
data = {}
for field in args:
data[field] = args[field]
super(Version, self).update(**data) | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"data",
"=",
"{",
"}",
"for",
"field",
"in",
"args",
":",
"data",
"[",
"field",
"]",
"=",
"args",
"[",
"field",
"]",
"super",
"(",
"Version",
",",
"self",
")",
".",
"update",
"(",
... | Update this project version from the server. It is prior used to archive versions. | [
"Update",
"this",
"project",
"version",
"from",
"the",
"server",
".",
"It",
"is",
"prior",
"used",
"to",
"archive",
"versions",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/resources.py#L896-L902 | train | Update this project version from the server. It is prior used to archive versions. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pycontribs/jira | jira/config.py | get_jira | def get_jira(profile=None, url="http://localhost:2990", username="admin", password="admin", appid=None, autofix=False, verify=True):
"""Return a JIRA object by loading the connection details from the `config.ini` file.
:param profile: The name of the section from config.ini file that stores server config url/u... | python | def get_jira(profile=None, url="http://localhost:2990", username="admin", password="admin", appid=None, autofix=False, verify=True):
"""Return a JIRA object by loading the connection details from the `config.ini` file.
:param profile: The name of the section from config.ini file that stores server config url/u... | [
"def",
"get_jira",
"(",
"profile",
"=",
"None",
",",
"url",
"=",
"\"http://localhost:2990\"",
",",
"username",
"=",
"\"admin\"",
",",
"password",
"=",
"\"admin\"",
",",
"appid",
"=",
"None",
",",
"autofix",
"=",
"False",
",",
"verify",
"=",
"True",
")",
... | Return a JIRA object by loading the connection details from the `config.ini` file.
:param profile: The name of the section from config.ini file that stores server config url/username/password
:param url: URL of the Jira server
:param username: username to use for authentication
:param password: passwor... | [
"Return",
"a",
"JIRA",
"object",
"by",
"loading",
"the",
"connection",
"details",
"from",
"the",
"config",
".",
"ini",
"file",
"."
] | 397db5d78441ed6a680a9b7db4c62030ade1fd8a | https://github.com/pycontribs/jira/blob/397db5d78441ed6a680a9b7db4c62030ade1fd8a/jira/config.py#L20-L97 | train | Return a JIRA object by loading the connection details from the config. ini file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/contrib/flask.py | make_view | def make_view(robot):
"""
为一个 BaseRoBot 生成 Flask view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!'
from flask import Flask
from werobot.contrib.flask import make... | python | def make_view(robot):
"""
为一个 BaseRoBot 生成 Flask view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!'
from flask import Flask
from werobot.contrib.flask import make... | [
"def",
"make_view",
"(",
"robot",
")",
":",
"def",
"werobot_view",
"(",
")",
":",
"timestamp",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'timestamp'",
",",
"''",
")",
"nonce",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'nonce'",
",",
"''",
... | 为一个 BaseRoBot 生成 Flask view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!'
from flask import Flask
from werobot.contrib.flask import make_view
app = Flask(__name_... | [
"为一个",
"BaseRoBot",
"生成",
"Flask",
"view。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/contrib/flask.py#L12-L63 | train | A function that returns a Flask view that can be used to view a specific wekite. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/config.py | Config.from_pyfile | def from_pyfile(self, filename):
"""
在一个 Python 文件中读取配置。
:param filename: 配置文件的文件名
:return: 如果读取成功,返回 ``True``,如果失败,会抛出错误异常
"""
d = types.ModuleType('config')
d.__file__ = filename
with open(filename) as config_file:
exec(compile(config_file.r... | python | def from_pyfile(self, filename):
"""
在一个 Python 文件中读取配置。
:param filename: 配置文件的文件名
:return: 如果读取成功,返回 ``True``,如果失败,会抛出错误异常
"""
d = types.ModuleType('config')
d.__file__ = filename
with open(filename) as config_file:
exec(compile(config_file.r... | [
"def",
"from_pyfile",
"(",
"self",
",",
"filename",
")",
":",
"d",
"=",
"types",
".",
"ModuleType",
"(",
"'config'",
")",
"d",
".",
"__file__",
"=",
"filename",
"with",
"open",
"(",
"filename",
")",
"as",
"config_file",
":",
"exec",
"(",
"compile",
"("... | 在一个 Python 文件中读取配置。
:param filename: 配置文件的文件名
:return: 如果读取成功,返回 ``True``,如果失败,会抛出错误异常 | [
"在一个",
"Python",
"文件中读取配置。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/config.py#L25-L37 | train | Load a set of attributes from a Python file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/contrib/tornado.py | make_handler | def make_handler(robot):
"""
为一个 BaseRoBot 生成 Tornado Handler。
Usage ::
import tornado.ioloop
import tornado.web
from werobot import WeRoBot
from tornado_werobot import make_handler
robot = WeRoBot(token='token')
@robot.handler
def hello(message):... | python | def make_handler(robot):
"""
为一个 BaseRoBot 生成 Tornado Handler。
Usage ::
import tornado.ioloop
import tornado.web
from werobot import WeRoBot
from tornado_werobot import make_handler
robot = WeRoBot(token='token')
@robot.handler
def hello(message):... | [
"def",
"make_handler",
"(",
"robot",
")",
":",
"class",
"WeRoBotHandler",
"(",
"RequestHandler",
")",
":",
"def",
"prepare",
"(",
"self",
")",
":",
"timestamp",
"=",
"self",
".",
"get_argument",
"(",
"'timestamp'",
",",
"''",
")",
"nonce",
"=",
"self",
"... | 为一个 BaseRoBot 生成 Tornado Handler。
Usage ::
import tornado.ioloop
import tornado.web
from werobot import WeRoBot
from tornado_werobot import make_handler
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!'
... | [
"为一个",
"BaseRoBot",
"生成",
"Tornado",
"Handler。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/contrib/tornado.py#L11-L74 | train | Returns a handler that can be used to handle a single message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/mongodbstorage.py | MongoDBStorage.get | def get(self, id):
"""
根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
"""
document = self._get_document(id)
if document:
session_json = document["session"]
return json_loads(session_json)
return {} | python | def get(self, id):
"""
根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
"""
document = self._get_document(id)
if document:
session_json = document["session"]
return json_loads(session_json)
return {} | [
"def",
"get",
"(",
"self",
",",
"id",
")",
":",
"document",
"=",
"self",
".",
"_get_document",
"(",
"id",
")",
"if",
"document",
":",
"session_json",
"=",
"document",
"[",
"\"session\"",
"]",
"return",
"json_loads",
"(",
"session_json",
")",
"return",
"{... | 根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象 | [
"根据",
"id",
"获取数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/mongodbstorage.py#L33-L44 | train | get a session by id | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/mongodbstorage.py | MongoDBStorage.set | def set(self, id, value):
"""
根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象
"""
session = json_dumps(value)
self.collection.replace_one(
{
"wechat_id": id
}, {
"wechat_id": id... | python | def set(self, id, value):
"""
根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象
"""
session = json_dumps(value)
self.collection.replace_one(
{
"wechat_id": id
}, {
"wechat_id": id... | [
"def",
"set",
"(",
"self",
",",
"id",
",",
"value",
")",
":",
"session",
"=",
"json_dumps",
"(",
"value",
")",
"self",
".",
"collection",
".",
"replace_one",
"(",
"{",
"\"wechat_id\"",
":",
"id",
"}",
",",
"{",
"\"wechat_id\"",
":",
"id",
",",
"\"ses... | 根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象 | [
"根据",
"id",
"写入数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/mongodbstorage.py#L46-L62 | train | set a new value for the wechat_id | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.grant_token | def grant_token(self):
"""
获取 Access Token。
:return: 返回的 JSON 数据包
"""
return self.get(
url="https://api.weixin.qq.com/cgi-bin/token",
params={
"grant_type": "client_credential",
"appid": self.appid,
"secret"... | python | def grant_token(self):
"""
获取 Access Token。
:return: 返回的 JSON 数据包
"""
return self.get(
url="https://api.weixin.qq.com/cgi-bin/token",
params={
"grant_type": "client_credential",
"appid": self.appid,
"secret"... | [
"def",
"grant_token",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/token\"",
",",
"params",
"=",
"{",
"\"grant_type\"",
":",
"\"client_credential\"",
",",
"\"appid\"",
":",
"self",
".",
"appid",
",",
... | 获取 Access Token。
:return: 返回的 JSON 数据包 | [
"获取",
"Access",
"Token。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L82-L95 | train | Grant a token to the user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.get_access_token | def get_access_token(self):
"""
判断现有的token是否过期。
用户需要多进程或者多机部署可以手动重写这个函数
来自定义token的存储,刷新策略。
:return: 返回token
"""
if self._token:
now = time.time()
if self.token_expires_at - now > 60:
return self._token
json = self.g... | python | def get_access_token(self):
"""
判断现有的token是否过期。
用户需要多进程或者多机部署可以手动重写这个函数
来自定义token的存储,刷新策略。
:return: 返回token
"""
if self._token:
now = time.time()
if self.token_expires_at - now > 60:
return self._token
json = self.g... | [
"def",
"get_access_token",
"(",
"self",
")",
":",
"if",
"self",
".",
"_token",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"if",
"self",
".",
"token_expires_at",
"-",
"now",
">",
"60",
":",
"return",
"self",
".",
"_token",
"json",
"=",
"self",
... | 判断现有的token是否过期。
用户需要多进程或者多机部署可以手动重写这个函数
来自定义token的存储,刷新策略。
:return: 返回token | [
"判断现有的token是否过期。",
"用户需要多进程或者多机部署可以手动重写这个函数",
"来自定义token的存储,刷新策略。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L97-L112 | train | Get the access token | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.create_custom_menu | def create_custom_menu(self, menu_data, matchrule):
"""
创建个性化菜单::
button = [
{
"type":"click",
"name":"今日歌曲",
"key":"V1001_TODAY_MUSIC"
},
{
"name":"菜单",
... | python | def create_custom_menu(self, menu_data, matchrule):
"""
创建个性化菜单::
button = [
{
"type":"click",
"name":"今日歌曲",
"key":"V1001_TODAY_MUSIC"
},
{
"name":"菜单",
... | [
"def",
"create_custom_menu",
"(",
"self",
",",
"menu_data",
",",
"matchrule",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/menu/addconditional\"",
",",
"data",
"=",
"{",
"\"button\"",
":",
"menu_data",
",",
"\"matc... | 创建个性化菜单::
button = [
{
"type":"click",
"name":"今日歌曲",
"key":"V1001_TODAY_MUSIC"
},
{
"name":"菜单",
"sub_button":[
{
... | [
"创建个性化菜单",
"::"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L188-L238 | train | Create custom menu. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.add_custom_service_account | def add_custom_service_account(self, account, nickname, password):
"""
添加客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/customservice/... | python | def add_custom_service_account(self, account, nickname, password):
"""
添加客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/customservice/... | [
"def",
"add_custom_service_account",
"(",
"self",
",",
"account",
",",
"nickname",
",",
"password",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/customservice/kfaccount/add\"",
",",
"data",
"=",
"{",
"\"kf_account\"",
":",
... | 添加客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包 | [
"添加客服帐号。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L274-L290 | train | Add a custom service account. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.update_custom_service_account | def update_custom_service_account(self, account, nickname, password):
"""
修改客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/customservi... | python | def update_custom_service_account(self, account, nickname, password):
"""
修改客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/customservi... | [
"def",
"update_custom_service_account",
"(",
"self",
",",
"account",
",",
"nickname",
",",
"password",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/customservice/kfaccount/update\"",
",",
"data",
"=",
"{",
"\"kf_account\"",
... | 修改客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包 | [
"修改客服帐号。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L292-L308 | train | Update the custom service account. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.delete_custom_service_account | def delete_custom_service_account(self, account, nickname, password):
"""
删除客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/customservi... | python | def delete_custom_service_account(self, account, nickname, password):
"""
删除客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/customservi... | [
"def",
"delete_custom_service_account",
"(",
"self",
",",
"account",
",",
"nickname",
",",
"password",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/customservice/kfaccount/del\"",
",",
"data",
"=",
"{",
"\"kf_account\"",
":"... | 删除客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包 | [
"删除客服帐号。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L310-L326 | train | Delete a custom service account. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.upload_custom_service_account_avatar | def upload_custom_service_account_avatar(self, account, avatar):
"""
设置客服帐号的头像。
:param account: 客服账号的用户名
:param avatar: 头像文件,必须是 jpg 格式
:return: 返回的 JSON 数据包
"""
return self.post(
url=
"http://api.weixin.qq.com/customservice/kfaccount/uplo... | python | def upload_custom_service_account_avatar(self, account, avatar):
"""
设置客服帐号的头像。
:param account: 客服账号的用户名
:param avatar: 头像文件,必须是 jpg 格式
:return: 返回的 JSON 数据包
"""
return self.post(
url=
"http://api.weixin.qq.com/customservice/kfaccount/uplo... | [
"def",
"upload_custom_service_account_avatar",
"(",
"self",
",",
"account",
",",
"avatar",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"http://api.weixin.qq.com/customservice/kfaccount/uploadheadimg\"",
",",
"params",
"=",
"{",
"\"access_token\"",
":",
... | 设置客服帐号的头像。
:param account: 客服账号的用户名
:param avatar: 头像文件,必须是 jpg 格式
:return: 返回的 JSON 数据包 | [
"设置客服帐号的头像。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L328-L344 | train | Upload a custom service account avatar | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.download_media | def download_media(self, media_id):
"""
下载临时多媒体文件。
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例
"""
return requests.get(
url="https://api.weixin.qq.com/cgi-bin/media/get",
params={
"access_token": self.token,
... | python | def download_media(self, media_id):
"""
下载临时多媒体文件。
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例
"""
return requests.get(
url="https://api.weixin.qq.com/cgi-bin/media/get",
params={
"access_token": self.token,
... | [
"def",
"download_media",
"(",
"self",
",",
"media_id",
")",
":",
"return",
"requests",
".",
"get",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/media/get\"",
",",
"params",
"=",
"{",
"\"access_token\"",
":",
"self",
".",
"token",
",",
"\"media_id\"",
":... | 下载临时多媒体文件。
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例 | [
"下载临时多媒体文件。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L383-L396 | train | Download a media from the API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.upload_news_picture | def upload_news_picture(self, file):
"""
上传图文消息内的图片。
:param file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/media/uploadimg",
params={"access_token": self.token},
files={"m... | python | def upload_news_picture(self, file):
"""
上传图文消息内的图片。
:param file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/media/uploadimg",
params={"access_token": self.token},
files={"m... | [
"def",
"upload_news_picture",
"(",
"self",
",",
"file",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/media/uploadimg\"",
",",
"params",
"=",
"{",
"\"access_token\"",
":",
"self",
".",
"token",
"}",
",",
"files",
... | 上传图文消息内的图片。
:param file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包 | [
"上传图文消息内的图片。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L423-L434 | train | Upload a news picture to the user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.upload_permanent_media | def upload_permanent_media(self, media_type, media_file):
"""
上传其他类型永久素材。
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/c... | python | def upload_permanent_media(self, media_type, media_file):
"""
上传其他类型永久素材。
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/c... | [
"def",
"upload_permanent_media",
"(",
"self",
",",
"media_type",
",",
"media_file",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/material/add_material\"",
",",
"params",
"=",
"{",
"\"access_token\"",
":",
"self",
"."... | 上传其他类型永久素材。
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包 | [
"上传其他类型永久素材。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L436-L451 | train | Upload permanent media to the KE - MEAN. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.upload_permanent_video | def upload_permanent_video(self, title, introduction, video):
"""
上传永久视频。
:param title: 视频素材的标题
:param introduction: 视频素材的描述
:param video: 要上传的视频,一个 File-object
:return: requests 的 Response 实例
"""
return requests.post(
url="https://api.weixin.... | python | def upload_permanent_video(self, title, introduction, video):
"""
上传永久视频。
:param title: 视频素材的标题
:param introduction: 视频素材的描述
:param video: 要上传的视频,一个 File-object
:return: requests 的 Response 实例
"""
return requests.post(
url="https://api.weixin.... | [
"def",
"upload_permanent_video",
"(",
"self",
",",
"title",
",",
"introduction",
",",
"video",
")",
":",
"return",
"requests",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/material/add_material\"",
",",
"params",
"=",
"{",
"\"access_token\"",
"... | 上传永久视频。
:param title: 视频素材的标题
:param introduction: 视频素材的描述
:param video: 要上传的视频,一个 File-object
:return: requests 的 Response 实例 | [
"上传永久视频。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L453-L478 | train | Upload a permanent video to the Keen - Music API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.download_permanent_media | def download_permanent_media(self, media_id):
"""
获取永久素材。
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例
"""
return requests.post(
url="https://api.weixin.qq.com/cgi-bin/material/get_material",
params={"access_token": self.token},
... | python | def download_permanent_media(self, media_id):
"""
获取永久素材。
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例
"""
return requests.post(
url="https://api.weixin.qq.com/cgi-bin/material/get_material",
params={"access_token": self.token},
... | [
"def",
"download_permanent_media",
"(",
"self",
",",
"media_id",
")",
":",
"return",
"requests",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/material/get_material\"",
",",
"params",
"=",
"{",
"\"access_token\"",
":",
"self",
".",
"token",
"}",... | 获取永久素材。
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例 | [
"获取永久素材。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L480-L493 | train | Downloads permanent media from the API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.get_media_list | def get_media_list(self, media_type, offset, count):
"""
获取素材列表。
:param media_type: 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news)
:param offset: 从全部素材的该偏移位置开始返回,0表示从第一个素材返回
:param count: 返回素材的数量,取值在1到20之间
:return: 返回的 JSON 数据包
"""
return self.post(
... | python | def get_media_list(self, media_type, offset, count):
"""
获取素材列表。
:param media_type: 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news)
:param offset: 从全部素材的该偏移位置开始返回,0表示从第一个素材返回
:param count: 返回素材的数量,取值在1到20之间
:return: 返回的 JSON 数据包
"""
return self.post(
... | [
"def",
"get_media_list",
"(",
"self",
",",
"media_type",
",",
"offset",
",",
"count",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/material/batchget_material\"",
",",
"data",
"=",
"{",
"\"type\"",
":",
"media_type"... | 获取素材列表。
:param media_type: 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news)
:param offset: 从全部素材的该偏移位置开始返回,0表示从第一个素材返回
:param count: 返回素材的数量,取值在1到20之间
:return: 返回的 JSON 数据包 | [
"获取素材列表。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L544-L560 | train | Get a list of media from the API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.create_group | def create_group(self, name):
"""
创建分组。
:param name: 分组名字(30个字符以内)
:return: 返回的 JSON 数据包
"""
name = to_text(name)
return self.post(
url="https://api.weixin.qq.com/cgi-bin/groups/create",
data={"group": {
"name": name
... | python | def create_group(self, name):
"""
创建分组。
:param name: 分组名字(30个字符以内)
:return: 返回的 JSON 数据包
"""
name = to_text(name)
return self.post(
url="https://api.weixin.qq.com/cgi-bin/groups/create",
data={"group": {
"name": name
... | [
"def",
"create_group",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"to_text",
"(",
"name",
")",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/groups/create\"",
",",
"data",
"=",
"{",
"\"group\"",
":",
"{",
"\"name\... | 创建分组。
:param name: 分组名字(30个字符以内)
:return: 返回的 JSON 数据包 | [
"创建分组。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L562-L576 | train | create a group | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.update_group | def update_group(self, group_id, name):
"""
修改分组名。
:param group_id: 分组 ID,由微信分配
:param name: 分组名字(30个字符以内)
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/groups/update",
data={"group": {
... | python | def update_group(self, group_id, name):
"""
修改分组名。
:param group_id: 分组 ID,由微信分配
:param name: 分组名字(30个字符以内)
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/groups/update",
data={"group": {
... | [
"def",
"update_group",
"(",
"self",
",",
"group_id",
",",
"name",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/groups/update\"",
",",
"data",
"=",
"{",
"\"group\"",
":",
"{",
"\"id\"",
":",
"int",
"(",
"group... | 修改分组名。
:param group_id: 分组 ID,由微信分配
:param name: 分组名字(30个字符以内)
:return: 返回的 JSON 数据包 | [
"修改分组名。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L598-L612 | train | Update the group name and ID | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.move_users | def move_users(self, user_id_list, group_id):
"""
批量移动用户分组。
:param user_id_list: 用户 ID 的列表(长度不能超过50)
:param group_id: 分组 ID
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/groups/members/batchupdate",
dat... | python | def move_users(self, user_id_list, group_id):
"""
批量移动用户分组。
:param user_id_list: 用户 ID 的列表(长度不能超过50)
:param group_id: 分组 ID
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/groups/members/batchupdate",
dat... | [
"def",
"move_users",
"(",
"self",
",",
"user_id_list",
",",
"group_id",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/groups/members/batchupdate\"",
",",
"data",
"=",
"{",
"\"openid_list\"",
":",
"user_id_list",
",",
... | 批量移动用户分组。
:param user_id_list: 用户 ID 的列表(长度不能超过50)
:param group_id: 分组 ID
:return: 返回的 JSON 数据包 | [
"批量移动用户分组。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L630-L644 | train | Move users to a group | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.remark_user | def remark_user(self, user_id, remark):
"""
设置备注名。
:param user_id: 设置备注名的用户 ID
:param remark: 新的备注名,长度必须小于30字符
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/user/info/updateremark",
data={
... | python | def remark_user(self, user_id, remark):
"""
设置备注名。
:param user_id: 设置备注名的用户 ID
:param remark: 新的备注名,长度必须小于30字符
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/user/info/updateremark",
data={
... | [
"def",
"remark_user",
"(",
"self",
",",
"user_id",
",",
"remark",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/user/info/updateremark\"",
",",
"data",
"=",
"{",
"\"openid\"",
":",
"user_id",
",",
"\"remark\"",
":... | 设置备注名。
:param user_id: 设置备注名的用户 ID
:param remark: 新的备注名,长度必须小于30字符
:return: 返回的 JSON 数据包 | [
"设置备注名。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L660-L674 | train | Update user s remark | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.get_user_info | def get_user_info(self, user_id, lang="zh_CN"):
"""
获取用户基本信息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
"""
return self.get(
url="https://api.weixin.qq.com/cgi-bin/user/info... | python | def get_user_info(self, user_id, lang="zh_CN"):
"""
获取用户基本信息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
"""
return self.get(
url="https://api.weixin.qq.com/cgi-bin/user/info... | [
"def",
"get_user_info",
"(",
"self",
",",
"user_id",
",",
"lang",
"=",
"\"zh_CN\"",
")",
":",
"return",
"self",
".",
"get",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/user/info\"",
",",
"params",
"=",
"{",
"\"access_token\"",
":",
"self",
".",
"toke... | 获取用户基本信息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包 | [
"获取用户基本信息。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L676-L691 | train | Get user info. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.get_users_info | def get_users_info(self, user_id_list, lang="zh_CN"):
"""
批量获取用户基本信息。
:param user_id_list: 用户 ID 的列表
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/user/info/batchget"... | python | def get_users_info(self, user_id_list, lang="zh_CN"):
"""
批量获取用户基本信息。
:param user_id_list: 用户 ID 的列表
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/user/info/batchget"... | [
"def",
"get_users_info",
"(",
"self",
",",
"user_id_list",
",",
"lang",
"=",
"\"zh_CN\"",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/user/info/batchget\"",
",",
"data",
"=",
"{",
"\"user_list\"",
":",
"[",
"{",... | 批量获取用户基本信息。
:param user_id_list: 用户 ID 的列表
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包 | [
"批量获取用户基本信息。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L693-L711 | train | Get user info | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.get_followers | def get_followers(self, first_user_id=None):
"""
获取关注者列表
详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表
:param first_user_id: 可选。第一个拉取的OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包
"""
params = {"access_token": self.token}
if first_user_id:
... | python | def get_followers(self, first_user_id=None):
"""
获取关注者列表
详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表
:param first_user_id: 可选。第一个拉取的OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包
"""
params = {"access_token": self.token}
if first_user_id:
... | [
"def",
"get_followers",
"(",
"self",
",",
"first_user_id",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"access_token\"",
":",
"self",
".",
"token",
"}",
"if",
"first_user_id",
":",
"params",
"[",
"\"next_openid\"",
"]",
"=",
"first_user_id",
"return",
"self... | 获取关注者列表
详情请参考 http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表
:param first_user_id: 可选。第一个拉取的OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包 | [
"获取关注者列表",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"index",
".",
"php?title",
"=",
"获取关注者列表"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L713-L726 | train | Get the list of followers. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.send_text_message | def send_text_message(self, user_id, content, kf_account=None):
"""
发送文本消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param content: 消息正文
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包
"""
data = {
"touser": us... | python | def send_text_message(self, user_id, content, kf_account=None):
"""
发送文本消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param content: 消息正文
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包
"""
data = {
"touser": us... | [
"def",
"send_text_message",
"(",
"self",
",",
"user_id",
",",
"content",
",",
"kf_account",
"=",
"None",
")",
":",
"data",
"=",
"{",
"\"touser\"",
":",
"user_id",
",",
"\"msgtype\"",
":",
"\"text\"",
",",
"\"text\"",
":",
"{",
"\"content\"",
":",
"content"... | 发送文本消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param content: 消息正文
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包 | [
"发送文本消息。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L728-L749 | train | Send a text message to a user | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.send_image_message | def send_image_message(self, user_id, media_id, kf_account=None):
"""
发送图片消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 图片的媒体ID。 可以通过 :func:`upload_media` 上传。
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包
"""
... | python | def send_image_message(self, user_id, media_id, kf_account=None):
"""
发送图片消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 图片的媒体ID。 可以通过 :func:`upload_media` 上传。
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包
"""
... | [
"def",
"send_image_message",
"(",
"self",
",",
"user_id",
",",
"media_id",
",",
"kf_account",
"=",
"None",
")",
":",
"data",
"=",
"{",
"\"touser\"",
":",
"user_id",
",",
"\"msgtype\"",
":",
"\"image\"",
",",
"\"image\"",
":",
"{",
"\"media_id\"",
":",
"med... | 发送图片消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 图片的媒体ID。 可以通过 :func:`upload_media` 上传。
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包 | [
"发送图片消息。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L751-L772 | train | Send an image message to the user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.send_voice_message | def send_voice_message(self, user_id, media_id, kf_account=None):
"""
发送语音消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 发送的语音的媒体ID。 可以通过 :func:`upload_media` 上传。
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包
"""
... | python | def send_voice_message(self, user_id, media_id, kf_account=None):
"""
发送语音消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 发送的语音的媒体ID。 可以通过 :func:`upload_media` 上传。
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包
"""
... | [
"def",
"send_voice_message",
"(",
"self",
",",
"user_id",
",",
"media_id",
",",
"kf_account",
"=",
"None",
")",
":",
"data",
"=",
"{",
"\"touser\"",
":",
"user_id",
",",
"\"msgtype\"",
":",
"\"voice\"",
",",
"\"voice\"",
":",
"{",
"\"media_id\"",
":",
"med... | 发送语音消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 发送的语音的媒体ID。 可以通过 :func:`upload_media` 上传。
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包 | [
"发送语音消息。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L774-L795 | train | Send voice message to user | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.send_music_message | def send_music_message(
self,
user_id,
url,
hq_url,
thumb_media_id,
title=None,
description=None,
kf_account=None
):
"""
发送音乐消息。
注意如果你遇到了缩略图不能正常显示的问题, 不要慌张; 目前来看是微信服务器端的问题。
对此我们也无能为力 ( `#197 <https://github.com/whtsky/We... | python | def send_music_message(
self,
user_id,
url,
hq_url,
thumb_media_id,
title=None,
description=None,
kf_account=None
):
"""
发送音乐消息。
注意如果你遇到了缩略图不能正常显示的问题, 不要慌张; 目前来看是微信服务器端的问题。
对此我们也无能为力 ( `#197 <https://github.com/whtsky/We... | [
"def",
"send_music_message",
"(",
"self",
",",
"user_id",
",",
"url",
",",
"hq_url",
",",
"thumb_media_id",
",",
"title",
"=",
"None",
",",
"description",
"=",
"None",
",",
"kf_account",
"=",
"None",
")",
":",
"music_data",
"=",
"{",
"\"musicurl\"",
":",
... | 发送音乐消息。
注意如果你遇到了缩略图不能正常显示的问题, 不要慌张; 目前来看是微信服务器端的问题。
对此我们也无能为力 ( `#197 <https://github.com/whtsky/WeRoBot/issues/197>`_ )
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param url: 音乐链接
:param hq_url: 高品质音乐链接,wifi环境优先使用该链接播放音乐
:param thumb_media_id: 缩略图的媒体ID。 可以通过 :fun... | [
"发送音乐消息。",
"注意如果你遇到了缩略图不能正常显示的问题,",
"不要慌张;",
"目前来看是微信服务器端的问题。",
"对此我们也无能为力",
"(",
"#197",
"<https",
":",
"//",
"github",
".",
"com",
"/",
"whtsky",
"/",
"WeRoBot",
"/",
"issues",
"/",
"197",
">",
"_",
")"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L825-L865 | train | Send a music message to the WeRoBot. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.send_article_message | def send_article_message(self, user_id, articles, kf_account=None):
"""
发送图文消息::
articles = [
{
"title":"Happy Day",
"description":"Is Really A Happy Day",
"url":"URL",
"picurl":"PIC_URL"
... | python | def send_article_message(self, user_id, articles, kf_account=None):
"""
发送图文消息::
articles = [
{
"title":"Happy Day",
"description":"Is Really A Happy Day",
"url":"URL",
"picurl":"PIC_URL"
... | [
"def",
"send_article_message",
"(",
"self",
",",
"user_id",
",",
"articles",
",",
"kf_account",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"articles",
"[",
"0",
"]",
",",
"Article",
")",
":",
"formatted_articles",
"=",
"[",
"]",
"for",
"article",
"i... | 发送图文消息::
articles = [
{
"title":"Happy Day",
"description":"Is Really A Happy Day",
"url":"URL",
"picurl":"PIC_URL"
},
{
"title":"Happy Day",
... | [
"发送图文消息",
"::"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L867-L912 | train | Send an article message to a user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.send_news_message | def send_news_message(self, user_id, media_id, kf_account=None):
"""
发送永久素材中的图文消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 媒体文件 ID
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包
"""
data = {
"... | python | def send_news_message(self, user_id, media_id, kf_account=None):
"""
发送永久素材中的图文消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 媒体文件 ID
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包
"""
data = {
"... | [
"def",
"send_news_message",
"(",
"self",
",",
"user_id",
",",
"media_id",
",",
"kf_account",
"=",
"None",
")",
":",
"data",
"=",
"{",
"\"touser\"",
":",
"user_id",
",",
"\"msgtype\"",
":",
"\"mpnews\"",
",",
"\"mpnews\"",
":",
"{",
"\"media_id\"",
":",
"me... | 发送永久素材中的图文消息。
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param media_id: 媒体文件 ID
:param kf_account: 发送消息的客服账户,默认值为 None,None 为不指定
:return: 返回的 JSON 数据包 | [
"发送永久素材中的图文消息。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L914-L935 | train | Send a news message to a user | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.send_miniprogrampage_message | def send_miniprogrampage_message(
self, user_id, title, appid, pagepath, thumb_media_id, kf_account=None
):
"""
发送小程序卡片(要求小程序与公众号已关联)
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param title: 小程序卡片的标题
:param appid: 小程序的 appid,要求小程序的 appid 需要与公众号有关联关系
:p... | python | def send_miniprogrampage_message(
self, user_id, title, appid, pagepath, thumb_media_id, kf_account=None
):
"""
发送小程序卡片(要求小程序与公众号已关联)
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param title: 小程序卡片的标题
:param appid: 小程序的 appid,要求小程序的 appid 需要与公众号有关联关系
:p... | [
"def",
"send_miniprogrampage_message",
"(",
"self",
",",
"user_id",
",",
"title",
",",
"appid",
",",
"pagepath",
",",
"thumb_media_id",
",",
"kf_account",
"=",
"None",
")",
":",
"data",
"=",
"{",
"\"touser\"",
":",
"user_id",
",",
"\"msgtype\"",
":",
"\"mini... | 发送小程序卡片(要求小程序与公众号已关联)
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param title: 小程序卡片的标题
:param appid: 小程序的 appid,要求小程序的 appid 需要与公众号有关联关系
:param pagepath: 小程序的页面路径,跟 app.json 对齐,支持参数,比如 pages/index/index?foo=bar
:param thumb_media_id: 小程序卡片图片的媒体 ID,小程序卡片图片建议大小为 520*416
... | [
"发送小程序卡片(要求小程序与公众号已关联)"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L937-L966 | train | Send a message to a user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.send_template_message | def send_template_message(self, user_id, template_id, data, url=''):
"""
发送模板消息
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param template_id: 模板 ID。
:param data: 用于渲染模板的数据。
:param... | python | def send_template_message(self, user_id, template_id, data, url=''):
"""
发送模板消息
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param template_id: 模板 ID。
:param data: 用于渲染模板的数据。
:param... | [
"def",
"send_template_message",
"(",
"self",
",",
"user_id",
",",
"template_id",
",",
"data",
",",
"url",
"=",
"''",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/message/template/send\"",
",",
"data",
"=",
"{",
... | 发送模板消息
详情请参考 http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param template_id: 模板 ID。
:param data: 用于渲染模板的数据。
:param url: 模板消息的可选链接。
:return: 返回的 JSON 数据包 | [
"发送模板消息",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"17",
"/",
"304c1885ea66dbedf7dc170d84999a9d",
".",
"html"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L991-L1010 | train | Send a template message to a user | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.update_tag | def update_tag(self, tag_id, tag_name):
"""
修改标签
:param tag_id: 标签 ID
:param tag_name: 新的标签名
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/tags/update",
data={"tag": {
"id": tag_id,
... | python | def update_tag(self, tag_id, tag_name):
"""
修改标签
:param tag_id: 标签 ID
:param tag_name: 新的标签名
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/tags/update",
data={"tag": {
"id": tag_id,
... | [
"def",
"update_tag",
"(",
"self",
",",
"tag_id",
",",
"tag_name",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/tags/update\"",
",",
"data",
"=",
"{",
"\"tag\"",
":",
"{",
"\"id\"",
":",
"tag_id",
",",
"\"name... | 修改标签
:param tag_id: 标签 ID
:param tag_name: 新的标签名
:return: 返回的 JSON 数据包 | [
"修改标签"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L1034-L1048 | train | Update the tag with the given ID and name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.get_users_by_tag | def get_users_by_tag(self, tag_id, next_open_id=""):
"""
获取标签下粉丝列表
:param tag_id: 标签 ID
:param next_open_id: 第一个拉取用户的 OPENID,默认从头开始拉取
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/user/tag/get",
data={
... | python | def get_users_by_tag(self, tag_id, next_open_id=""):
"""
获取标签下粉丝列表
:param tag_id: 标签 ID
:param next_open_id: 第一个拉取用户的 OPENID,默认从头开始拉取
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/user/tag/get",
data={
... | [
"def",
"get_users_by_tag",
"(",
"self",
",",
"tag_id",
",",
"next_open_id",
"=",
"\"\"",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/user/tag/get\"",
",",
"data",
"=",
"{",
"\"tagid\"",
":",
"tag_id",
",",
"\"... | 获取标签下粉丝列表
:param tag_id: 标签 ID
:param next_open_id: 第一个拉取用户的 OPENID,默认从头开始拉取
:return: 返回的 JSON 数据包 | [
"获取标签下粉丝列表"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L1064-L1078 | train | Get users by tag | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.tag_users | def tag_users(self, tag_id, open_id_list):
"""
批量为用户打标签
:param tag_id: 标签 ID
:param open_id_list: 包含一个或多个用户的 OPENID 的列表
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging",
data={
... | python | def tag_users(self, tag_id, open_id_list):
"""
批量为用户打标签
:param tag_id: 标签 ID
:param open_id_list: 包含一个或多个用户的 OPENID 的列表
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging",
data={
... | [
"def",
"tag_users",
"(",
"self",
",",
"tag_id",
",",
"open_id_list",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging\"",
",",
"data",
"=",
"{",
"\"openid_list\"",
":",
"open_id_list",
",",
"\... | 批量为用户打标签
:param tag_id: 标签 ID
:param open_id_list: 包含一个或多个用户的 OPENID 的列表
:return: 返回的 JSON 数据包 | [
"批量为用户打标签"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L1094-L1108 | train | Tag users with a given tag. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/client.py | Client.untag_users | def untag_users(self, tag_id, open_id_list):
"""
批量为用户取消标签
:param tag_id: 标签 ID
:param open_id_list: 包含一个或多个用户的 OPENID 的列表
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging",
dat... | python | def untag_users(self, tag_id, open_id_list):
"""
批量为用户取消标签
:param tag_id: 标签 ID
:param open_id_list: 包含一个或多个用户的 OPENID 的列表
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging",
dat... | [
"def",
"untag_users",
"(",
"self",
",",
"tag_id",
",",
"open_id_list",
")",
":",
"return",
"self",
".",
"post",
"(",
"url",
"=",
"\"https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging\"",
",",
"data",
"=",
"{",
"\"openid_list\"",
":",
"open_id_list",
",",
... | 批量为用户取消标签
:param tag_id: 标签 ID
:param open_id_list: 包含一个或多个用户的 OPENID 的列表
:return: 返回的 JSON 数据包 | [
"批量为用户取消标签"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L1110-L1124 | train | Untag users with a given tag. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/filestorage.py | FileStorage.get | def get(self, id):
"""
根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
"""
try:
session_json = self.db[id]
except KeyError:
session_json = "{}"
return json_loads(session_json) | python | def get(self, id):
"""
根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
"""
try:
session_json = self.db[id]
except KeyError:
session_json = "{}"
return json_loads(session_json) | [
"def",
"get",
"(",
"self",
",",
"id",
")",
":",
"try",
":",
"session_json",
"=",
"self",
".",
"db",
"[",
"id",
"]",
"except",
"KeyError",
":",
"session_json",
"=",
"\"{}\"",
"return",
"json_loads",
"(",
"session_json",
")"
] | 根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象 | [
"根据",
"id",
"获取数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/filestorage.py#L28-L39 | train | get a single object from the cache | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/crypto/__init__.py | PrpCrypto.encrypt | def encrypt(self, text, app_id):
"""
对明文进行加密
:param text: 需要加密的明文
:param app_id: 微信公众平台的 AppID
:return: 加密后的字符串
"""
text = b"".join(
[
to_binary(self.get_random_string()),
struct.pack(b"I", socket.htonl(len(to_binary(tex... | python | def encrypt(self, text, app_id):
"""
对明文进行加密
:param text: 需要加密的明文
:param app_id: 微信公众平台的 AppID
:return: 加密后的字符串
"""
text = b"".join(
[
to_binary(self.get_random_string()),
struct.pack(b"I", socket.htonl(len(to_binary(tex... | [
"def",
"encrypt",
"(",
"self",
",",
"text",
",",
"app_id",
")",
":",
"text",
"=",
"b\"\"",
".",
"join",
"(",
"[",
"to_binary",
"(",
"self",
".",
"get_random_string",
"(",
")",
")",
",",
"struct",
".",
"pack",
"(",
"b\"I\"",
",",
"socket",
".",
"hto... | 对明文进行加密
:param text: 需要加密的明文
:param app_id: 微信公众平台的 AppID
:return: 加密后的字符串 | [
"对明文进行加密",
":",
"param",
"text",
":",
"需要加密的明文",
":",
"param",
"app_id",
":",
"微信公众平台的",
"AppID",
":",
"return",
":",
"加密后的字符串"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/crypto/__init__.py#L45-L63 | train | encrypt text with the current cipher | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/crypto/__init__.py | PrpCrypto.decrypt | def decrypt(self, text, app_id):
"""
对密文进行解密
:param text: 需要解密的密文
:param app_id: 微信公众平台的 AppID
:return: 解密后的字符串
"""
text = to_binary(text)
decryptor = self.cipher.decryptor()
plain_text = decryptor.update(base64.b64decode(text)
... | python | def decrypt(self, text, app_id):
"""
对密文进行解密
:param text: 需要解密的密文
:param app_id: 微信公众平台的 AppID
:return: 解密后的字符串
"""
text = to_binary(text)
decryptor = self.cipher.decryptor()
plain_text = decryptor.update(base64.b64decode(text)
... | [
"def",
"decrypt",
"(",
"self",
",",
"text",
",",
"app_id",
")",
":",
"text",
"=",
"to_binary",
"(",
"text",
")",
"decryptor",
"=",
"self",
".",
"cipher",
".",
"decryptor",
"(",
")",
"plain_text",
"=",
"decryptor",
".",
"update",
"(",
"base64",
".",
"... | 对密文进行解密
:param text: 需要解密的密文
:param app_id: 微信公众平台的 AppID
:return: 解密后的字符串 | [
"对密文进行解密",
":",
"param",
"text",
":",
"需要解密的密文",
":",
"param",
"app_id",
":",
"微信公众平台的",
"AppID",
":",
"return",
":",
"解密后的字符串"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/crypto/__init__.py#L65-L87 | train | Decrypt a text and return the xml content | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/crypto/__init__.py | MessageCrypt.decrypt_message | def decrypt_message(self, timestamp, nonce, msg_signature, encrypt_msg):
"""
解密收到的微信消息
:param timestamp: 请求 URL 中收到的 timestamp
:param nonce: 请求 URL 中收到的 nonce
:param msg_signature: 请求 URL 中收到的 msg_signature
:param encrypt_msg: 收到的加密文本. ( XML 中的 <Encrypt> 部分 )
:ret... | python | def decrypt_message(self, timestamp, nonce, msg_signature, encrypt_msg):
"""
解密收到的微信消息
:param timestamp: 请求 URL 中收到的 timestamp
:param nonce: 请求 URL 中收到的 nonce
:param msg_signature: 请求 URL 中收到的 msg_signature
:param encrypt_msg: 收到的加密文本. ( XML 中的 <Encrypt> 部分 )
:ret... | [
"def",
"decrypt_message",
"(",
"self",
",",
"timestamp",
",",
"nonce",
",",
"msg_signature",
",",
"encrypt_msg",
")",
":",
"signature",
"=",
"get_signature",
"(",
"self",
".",
"token",
",",
"timestamp",
",",
"nonce",
",",
"encrypt_msg",
")",
"if",
"signature... | 解密收到的微信消息
:param timestamp: 请求 URL 中收到的 timestamp
:param nonce: 请求 URL 中收到的 nonce
:param msg_signature: 请求 URL 中收到的 msg_signature
:param encrypt_msg: 收到的加密文本. ( XML 中的 <Encrypt> 部分 )
:return: 解密后的 XML 文本 | [
"解密收到的微信消息",
":",
"param",
"timestamp",
":",
"请求",
"URL",
"中收到的",
"timestamp",
":",
"param",
"nonce",
":",
"请求",
"URL",
"中收到的",
"nonce",
":",
"param",
"msg_signature",
":",
"请求",
"URL",
"中收到的",
"msg_signature",
":",
"param",
"encrypt_msg",
":",
"收到的加密文本",
... | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/crypto/__init__.py#L109-L121 | train | decrypt_message - Decrypt a message | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/crypto/__init__.py | MessageCrypt.encrypt_message | def encrypt_message(self, reply, timestamp=None, nonce=None):
"""
加密微信回复
:param reply: 加密前的回复
:type reply: WeChatReply 或 XML 文本
:return: 加密后的回复文本
"""
if hasattr(reply, "render"):
reply = reply.render()
timestamp = timestamp or to_text(int(time... | python | def encrypt_message(self, reply, timestamp=None, nonce=None):
"""
加密微信回复
:param reply: 加密前的回复
:type reply: WeChatReply 或 XML 文本
:return: 加密后的回复文本
"""
if hasattr(reply, "render"):
reply = reply.render()
timestamp = timestamp or to_text(int(time... | [
"def",
"encrypt_message",
"(",
"self",
",",
"reply",
",",
"timestamp",
"=",
"None",
",",
"nonce",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"reply",
",",
"\"render\"",
")",
":",
"reply",
"=",
"reply",
".",
"render",
"(",
")",
"timestamp",
"=",
"ti... | 加密微信回复
:param reply: 加密前的回复
:type reply: WeChatReply 或 XML 文本
:return: 加密后的回复文本 | [
"加密微信回复",
":",
"param",
"reply",
":",
"加密前的回复",
":",
"type",
"reply",
":",
"WeChatReply",
"或",
"XML",
"文本",
":",
"return",
":",
"加密后的回复文本"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/crypto/__init__.py#L123-L144 | train | Encrypt a message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/saekvstorage.py | SaeKVDBStorage.set | def set(self, id, value):
"""
根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象
"""
return self.kv.set(self.key_name(id), value) | python | def set(self, id, value):
"""
根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象
"""
return self.kv.set(self.key_name(id), value) | [
"def",
"set",
"(",
"self",
",",
"id",
",",
"value",
")",
":",
"return",
"self",
".",
"kv",
".",
"set",
"(",
"self",
".",
"key_name",
"(",
"id",
")",
",",
"value",
")"
] | 根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象 | [
"根据",
"id",
"写入数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/saekvstorage.py#L42-L49 | train | set value in the cache | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/contrib/django.py | make_view | def make_view(robot):
"""
为一个 BaseRoBot 生成 Django view。
:param robot: 一个 BaseRoBot 实例。
:return: 一个标准的 Django view
"""
@csrf_exempt
def werobot_view(request):
timestamp = request.GET.get("timestamp", "")
nonce = request.GET.get("nonce", "")
signature = request.GET.ge... | python | def make_view(robot):
"""
为一个 BaseRoBot 生成 Django view。
:param robot: 一个 BaseRoBot 实例。
:return: 一个标准的 Django view
"""
@csrf_exempt
def werobot_view(request):
timestamp = request.GET.get("timestamp", "")
nonce = request.GET.get("nonce", "")
signature = request.GET.ge... | [
"def",
"make_view",
"(",
"robot",
")",
":",
"@",
"csrf_exempt",
"def",
"werobot_view",
"(",
"request",
")",
":",
"timestamp",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"\"timestamp\"",
",",
"\"\"",
")",
"nonce",
"=",
"request",
".",
"GET",
".",
"get... | 为一个 BaseRoBot 生成 Django view。
:param robot: 一个 BaseRoBot 实例。
:return: 一个标准的 Django view | [
"为一个",
"BaseRoBot",
"生成",
"Django",
"view。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/contrib/django.py#L13-L50 | train | Returns a Django view that can be used to view a single object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/pay.py | WeixinPayClient.create_js_pay_package | def create_js_pay_package(self, **package):
"""
签名 pay package 需要的参数
详情请参考 支付开发文档
:param package: 需要签名的的参数
:return: 可以使用的packagestr
"""
assert self.pay_partner_id, "PAY_PARTNER_ID IS EMPTY"
assert self.pay_partner_key, "PAY_PARTNER_KEY IS EMPTY"
... | python | def create_js_pay_package(self, **package):
"""
签名 pay package 需要的参数
详情请参考 支付开发文档
:param package: 需要签名的的参数
:return: 可以使用的packagestr
"""
assert self.pay_partner_id, "PAY_PARTNER_ID IS EMPTY"
assert self.pay_partner_key, "PAY_PARTNER_KEY IS EMPTY"
... | [
"def",
"create_js_pay_package",
"(",
"self",
",",
"*",
"*",
"package",
")",
":",
"assert",
"self",
".",
"pay_partner_id",
",",
"\"PAY_PARTNER_ID IS EMPTY\"",
"assert",
"self",
".",
"pay_partner_key",
",",
"\"PAY_PARTNER_KEY IS EMPTY\"",
"package",
".",
"update",
"("... | 签名 pay package 需要的参数
详情请参考 支付开发文档
:param package: 需要签名的的参数
:return: 可以使用的packagestr | [
"签名",
"pay",
"package",
"需要的参数",
"详情请参考",
"支付开发文档"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/pay.py#L27-L58 | train | create pay package | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/pay.py | WeixinPayClient.create_js_pay_params | def create_js_pay_params(self, **package):
"""
签名 js 需要的参数
详情请参考 支付开发文档
::
wxclient.create_js_pay_params(
body=标题, out_trade_no=本地订单号, total_fee=价格单位分,
notify_url=通知url,
spbill_create_ip=建议为支付人ip,
)
:param... | python | def create_js_pay_params(self, **package):
"""
签名 js 需要的参数
详情请参考 支付开发文档
::
wxclient.create_js_pay_params(
body=标题, out_trade_no=本地订单号, total_fee=价格单位分,
notify_url=通知url,
spbill_create_ip=建议为支付人ip,
)
:param... | [
"def",
"create_js_pay_params",
"(",
"self",
",",
"*",
"*",
"package",
")",
":",
"pay_param",
",",
"sign",
",",
"sign_type",
"=",
"self",
".",
"_pay_sign_dict",
"(",
"package",
"=",
"self",
".",
"create_js_pay_package",
"(",
"*",
"*",
"package",
")",
")",
... | 签名 js 需要的参数
详情请参考 支付开发文档
::
wxclient.create_js_pay_params(
body=标题, out_trade_no=本地订单号, total_fee=价格单位分,
notify_url=通知url,
spbill_create_ip=建议为支付人ip,
)
:param package: 需要签名的的参数
:return: 支付需要的对象 | [
"签名",
"js",
"需要的参数",
"详情请参考",
"支付开发文档"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/pay.py#L60-L86 | train | create js 需要签名 js 需要的 js 需要签名 js 需要的 js 需要的 js 需要签名 js 需要的 js 需要签 | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/pay.py | WeixinPayClient.create_js_edit_address_param | def create_js_edit_address_param(self, accesstoken, **params):
"""
alpha
暂时不建议使用
这个接口使用起来十分不友好
而且会引起巨大的误解
url 需要带上 code 和 state (url?code=xxx&state=1)
code 和state 是 oauth 时候回来的
token 要传用户的 token
这尼玛 你能相信这些支付接口都是腾讯出的?
"""
params.u... | python | def create_js_edit_address_param(self, accesstoken, **params):
"""
alpha
暂时不建议使用
这个接口使用起来十分不友好
而且会引起巨大的误解
url 需要带上 code 和 state (url?code=xxx&state=1)
code 和state 是 oauth 时候回来的
token 要传用户的 token
这尼玛 你能相信这些支付接口都是腾讯出的?
"""
params.u... | [
"def",
"create_js_edit_address_param",
"(",
"self",
",",
"accesstoken",
",",
"*",
"*",
"params",
")",
":",
"params",
".",
"update",
"(",
"{",
"'appId'",
":",
"self",
".",
"appid",
",",
"'nonceStr'",
":",
"generate_token",
"(",
"8",
")",
",",
"'timeStamp'",... | alpha
暂时不建议使用
这个接口使用起来十分不友好
而且会引起巨大的误解
url 需要带上 code 和 state (url?code=xxx&state=1)
code 和state 是 oauth 时候回来的
token 要传用户的 token
这尼玛 你能相信这些支付接口都是腾讯出的? | [
"alpha",
"暂时不建议使用",
"这个接口使用起来十分不友好",
"而且会引起巨大的误解"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/pay.py#L88-L123 | train | create js_edit_address_param - create js_edit_address_param | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/pay.py | WeixinPayClient.create_native_pay_url | def create_native_pay_url(self, productid):
"""
创建 native pay url
详情请参考 支付开发文档
:param productid: 本地商品ID
:return: 返回URL
"""
params, sign, = self._pay_sign_dict(productid=productid)
params['sign'] = sign
return NATIVE_BASE_URL + urlencode(params) | python | def create_native_pay_url(self, productid):
"""
创建 native pay url
详情请参考 支付开发文档
:param productid: 本地商品ID
:return: 返回URL
"""
params, sign, = self._pay_sign_dict(productid=productid)
params['sign'] = sign
return NATIVE_BASE_URL + urlencode(params) | [
"def",
"create_native_pay_url",
"(",
"self",
",",
"productid",
")",
":",
"params",
",",
"sign",
",",
"=",
"self",
".",
"_pay_sign_dict",
"(",
"productid",
"=",
"productid",
")",
"params",
"[",
"'sign'",
"]",
"=",
"sign",
"return",
"NATIVE_BASE_URL",
"+",
"... | 创建 native pay url
详情请参考 支付开发文档
:param productid: 本地商品ID
:return: 返回URL | [
"创建",
"native",
"pay",
"url",
"详情请参考",
"支付开发文档"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/pay.py#L125-L138 | train | create_native_pay_url - create native pay url | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/pay.py | WeixinPayClient.pay_deliver_notify | def pay_deliver_notify(self, **deliver_info):
"""
通知 腾讯发货
一般形式 ::
wxclient.pay_delivernotify(
openid=openid,
transid=transaction_id,
out_trade_no=本地订单号,
deliver_timestamp=int(time.time()),
deliver_status... | python | def pay_deliver_notify(self, **deliver_info):
"""
通知 腾讯发货
一般形式 ::
wxclient.pay_delivernotify(
openid=openid,
transid=transaction_id,
out_trade_no=本地订单号,
deliver_timestamp=int(time.time()),
deliver_status... | [
"def",
"pay_deliver_notify",
"(",
"self",
",",
"*",
"*",
"deliver_info",
")",
":",
"params",
",",
"sign",
",",
"_",
"=",
"self",
".",
"_pay_sign_dict",
"(",
"add_noncestr",
"=",
"False",
",",
"add_timestamp",
"=",
"False",
",",
"*",
"*",
"deliver_info",
... | 通知 腾讯发货
一般形式 ::
wxclient.pay_delivernotify(
openid=openid,
transid=transaction_id,
out_trade_no=本地订单号,
deliver_timestamp=int(time.time()),
deliver_status="1",
deliver_msg="ok"
)
:par... | [
"通知",
"腾讯发货"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/pay.py#L140-L166 | train | pay_deliver_notify 调用pay_delivernotify | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/pay.py | WeixinPayClient.pay_order_query | def pay_order_query(self, out_trade_no):
"""
查询订单状态
一般用于无法确定 订单状态时候补偿
:param out_trade_no: 本地订单号
:return: 订单信息dict
"""
package = {
'partner': self.pay_partner_id,
'out_trade_no': out_trade_no,
}
_package = package.items()... | python | def pay_order_query(self, out_trade_no):
"""
查询订单状态
一般用于无法确定 订单状态时候补偿
:param out_trade_no: 本地订单号
:return: 订单信息dict
"""
package = {
'partner': self.pay_partner_id,
'out_trade_no': out_trade_no,
}
_package = package.items()... | [
"def",
"pay_order_query",
"(",
"self",
",",
"out_trade_no",
")",
":",
"package",
"=",
"{",
"'partner'",
":",
"self",
".",
"pay_partner_id",
",",
"'out_trade_no'",
":",
"out_trade_no",
",",
"}",
"_package",
"=",
"package",
".",
"items",
"(",
")",
"_package",
... | 查询订单状态
一般用于无法确定 订单状态时候补偿
:param out_trade_no: 本地订单号
:return: 订单信息dict | [
"查询订单状态",
"一般用于无法确定",
"订单状态时候补偿"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/pay.py#L168-L204 | train | Pay Order Query | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/utils.py | byte2int | def byte2int(s, index=0):
"""Get the ASCII int value of a character in a string.
:param s: a string
:param index: the position of desired character
:return: ASCII int value
"""
if six.PY2:
return ord(s[index])
return s[index] | python | def byte2int(s, index=0):
"""Get the ASCII int value of a character in a string.
:param s: a string
:param index: the position of desired character
:return: ASCII int value
"""
if six.PY2:
return ord(s[index])
return s[index] | [
"def",
"byte2int",
"(",
"s",
",",
"index",
"=",
"0",
")",
":",
"if",
"six",
".",
"PY2",
":",
"return",
"ord",
"(",
"s",
"[",
"index",
"]",
")",
"return",
"s",
"[",
"index",
"]"
] | Get the ASCII int value of a character in a string.
:param s: a string
:param index: the position of desired character
:return: ASCII int value | [
"Get",
"the",
"ASCII",
"int",
"value",
"of",
"a",
"character",
"in",
"a",
"string",
"."
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/utils.py#L76-L86 | train | Get the ASCII int value of a character in a string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/utils.py | pay_sign_dict | def pay_sign_dict(
appid,
pay_sign_key,
add_noncestr=True,
add_timestamp=True,
add_appid=True,
**kwargs
):
"""
支付参数签名
"""
assert pay_sign_key, "PAY SIGN KEY IS EMPTY"
if add_appid:
kwargs.update({'appid': appid})
if add_noncestr:
kwargs.update({'noncestr... | python | def pay_sign_dict(
appid,
pay_sign_key,
add_noncestr=True,
add_timestamp=True,
add_appid=True,
**kwargs
):
"""
支付参数签名
"""
assert pay_sign_key, "PAY SIGN KEY IS EMPTY"
if add_appid:
kwargs.update({'appid': appid})
if add_noncestr:
kwargs.update({'noncestr... | [
"def",
"pay_sign_dict",
"(",
"appid",
",",
"pay_sign_key",
",",
"add_noncestr",
"=",
"True",
",",
"add_timestamp",
"=",
"True",
",",
"add_appid",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"pay_sign_key",
",",
"\"PAY SIGN KEY IS EMPTY\"",
"if",
... | 支付参数签名 | [
"支付参数签名"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/utils.py#L107-L142 | train | Returns a dict with the parameters and the sign and sign_type | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | BaseRoBot.key_click | def key_click(self, key):
"""
为自定义菜单 ``(click)`` 事件添加 handler 的简便方法。
**@key_click('KEYNAME')** 用来为特定 key 的点击事件添加 handler 方法。
"""
def wraps(f):
argc = len(signature(f).parameters.keys())
@self.click
def onclick(message, session=None):
... | python | def key_click(self, key):
"""
为自定义菜单 ``(click)`` 事件添加 handler 的简便方法。
**@key_click('KEYNAME')** 用来为特定 key 的点击事件添加 handler 方法。
"""
def wraps(f):
argc = len(signature(f).parameters.keys())
@self.click
def onclick(message, session=None):
... | [
"def",
"key_click",
"(",
"self",
",",
"key",
")",
":",
"def",
"wraps",
"(",
"f",
")",
":",
"argc",
"=",
"len",
"(",
"signature",
"(",
"f",
")",
".",
"parameters",
".",
"keys",
"(",
")",
")",
"@",
"self",
".",
"click",
"def",
"onclick",
"(",
"me... | 为自定义菜单 ``(click)`` 事件添加 handler 的简便方法。
**@key_click('KEYNAME')** 用来为特定 key 的点击事件添加 handler 方法。 | [
"为自定义菜单",
"(",
"click",
")",
"事件添加",
"handler",
"的简便方法。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L467-L484 | train | Decorator for key click event handler | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | BaseRoBot.filter | def filter(self, *args):
"""
为文本 ``(text)`` 消息添加 handler 的简便方法。
使用 ``@filter("xxx")``, ``@filter(re.compile("xxx"))``
或 ``@filter("xxx", "xxx2")`` 的形式为特定内容添加 handler。
"""
def wraps(f):
self.add_filter(func=f, rules=list(args))
return f
r... | python | def filter(self, *args):
"""
为文本 ``(text)`` 消息添加 handler 的简便方法。
使用 ``@filter("xxx")``, ``@filter(re.compile("xxx"))``
或 ``@filter("xxx", "xxx2")`` 的形式为特定内容添加 handler。
"""
def wraps(f):
self.add_filter(func=f, rules=list(args))
return f
r... | [
"def",
"filter",
"(",
"self",
",",
"*",
"args",
")",
":",
"def",
"wraps",
"(",
"f",
")",
":",
"self",
".",
"add_filter",
"(",
"func",
"=",
"f",
",",
"rules",
"=",
"list",
"(",
"args",
")",
")",
"return",
"f",
"return",
"wraps"
] | 为文本 ``(text)`` 消息添加 handler 的简便方法。
使用 ``@filter("xxx")``, ``@filter(re.compile("xxx"))``
或 ``@filter("xxx", "xxx2")`` 的形式为特定内容添加 handler。 | [
"为文本",
"(",
"text",
")",
"消息添加",
"handler",
"的简便方法。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L486-L498 | train | Decorator to add a filter to the current instance. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | BaseRoBot.add_handler | def add_handler(self, func, type='all'):
"""
为 BaseRoBot 实例添加一个 handler。
:param func: 要作为 handler 的方法。
:param type: handler 的种类。
:return: None
"""
if not callable(func):
raise ValueError("{} is not callable".format(func))
self._handlers[type]... | python | def add_handler(self, func, type='all'):
"""
为 BaseRoBot 实例添加一个 handler。
:param func: 要作为 handler 的方法。
:param type: handler 的种类。
:return: None
"""
if not callable(func):
raise ValueError("{} is not callable".format(func))
self._handlers[type]... | [
"def",
"add_handler",
"(",
"self",
",",
"func",
",",
"type",
"=",
"'all'",
")",
":",
"if",
"not",
"callable",
"(",
"func",
")",
":",
"raise",
"ValueError",
"(",
"\"{} is not callable\"",
".",
"format",
"(",
"func",
")",
")",
"self",
".",
"_handlers",
"... | 为 BaseRoBot 实例添加一个 handler。
:param func: 要作为 handler 的方法。
:param type: handler 的种类。
:return: None | [
"为",
"BaseRoBot",
"实例添加一个",
"handler。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L500-L513 | train | Add a handler to the list of handlers. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | BaseRoBot.add_filter | def add_filter(self, func, rules):
"""
为 BaseRoBot 添加一个 ``filter handler``。
:param func: 如果 rules 通过,则处理该消息的 handler。
:param rules: 一个 list,包含要匹配的字符串或者正则表达式。
:return: None
"""
if not callable(func):
raise ValueError("{} is not callable".format(func))
... | python | def add_filter(self, func, rules):
"""
为 BaseRoBot 添加一个 ``filter handler``。
:param func: 如果 rules 通过,则处理该消息的 handler。
:param rules: 一个 list,包含要匹配的字符串或者正则表达式。
:return: None
"""
if not callable(func):
raise ValueError("{} is not callable".format(func))
... | [
"def",
"add_filter",
"(",
"self",
",",
"func",
",",
"rules",
")",
":",
"if",
"not",
"callable",
"(",
"func",
")",
":",
"raise",
"ValueError",
"(",
"\"{} is not callable\"",
".",
"format",
"(",
"func",
")",
")",
"if",
"not",
"isinstance",
"(",
"rules",
... | 为 BaseRoBot 添加一个 ``filter handler``。
:param func: 如果 rules 通过,则处理该消息的 handler。
:param rules: 一个 list,包含要匹配的字符串或者正则表达式。
:return: None | [
"为",
"BaseRoBot",
"添加一个",
"filter",
"handler",
"。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L518-L554 | train | Add filter to BaseRoBot. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | BaseRoBot.parse_message | def parse_message(
self, body, timestamp=None, nonce=None, msg_signature=None
):
"""
解析获取到的 Raw XML ,如果需要的话进行解密,返回 WeRoBot Message。
:param body: 微信服务器发来的请求中的 Body。
:return: WeRoBot Message
"""
message_dict = parse_xml(body)
if "Encrypt" in message_dict... | python | def parse_message(
self, body, timestamp=None, nonce=None, msg_signature=None
):
"""
解析获取到的 Raw XML ,如果需要的话进行解密,返回 WeRoBot Message。
:param body: 微信服务器发来的请求中的 Body。
:return: WeRoBot Message
"""
message_dict = parse_xml(body)
if "Encrypt" in message_dict... | [
"def",
"parse_message",
"(",
"self",
",",
"body",
",",
"timestamp",
"=",
"None",
",",
"nonce",
"=",
"None",
",",
"msg_signature",
"=",
"None",
")",
":",
"message_dict",
"=",
"parse_xml",
"(",
"body",
")",
"if",
"\"Encrypt\"",
"in",
"message_dict",
":",
"... | 解析获取到的 Raw XML ,如果需要的话进行解密,返回 WeRoBot Message。
:param body: 微信服务器发来的请求中的 Body。
:return: WeRoBot Message | [
"解析获取到的",
"Raw",
"XML",
",如果需要的话进行解密,返回",
"WeRoBot",
"Message。",
":",
"param",
"body",
":",
"微信服务器发来的请求中的",
"Body。",
":",
"return",
":",
"WeRoBot",
"Message"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L556-L573 | train | Parse a message from a raw XML body. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | BaseRoBot.get_reply | def get_reply(self, message):
"""
根据 message 的内容获取 Reply 对象。
:param message: 要处理的 message
:return: 获取的 Reply 对象
"""
session_storage = self.session_storage
id = None
session = None
if session_storage and hasattr(message, "source"):
id ... | python | def get_reply(self, message):
"""
根据 message 的内容获取 Reply 对象。
:param message: 要处理的 message
:return: 获取的 Reply 对象
"""
session_storage = self.session_storage
id = None
session = None
if session_storage and hasattr(message, "source"):
id ... | [
"def",
"get_reply",
"(",
"self",
",",
"message",
")",
":",
"session_storage",
"=",
"self",
".",
"session_storage",
"id",
"=",
"None",
"session",
"=",
"None",
"if",
"session_storage",
"and",
"hasattr",
"(",
"message",
",",
"\"source\"",
")",
":",
"id",
"=",... | 根据 message 的内容获取 Reply 对象。
:param message: 要处理的 message
:return: 获取的 Reply 对象 | [
"根据",
"message",
"的内容获取",
"Reply",
"对象。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L575-L600 | train | Get reply from the message. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | BaseRoBot.get_encrypted_reply | def get_encrypted_reply(self, message):
"""
对一个指定的 WeRoBot Message ,获取 handlers 处理后得到的 Reply。
如果可能,对该 Reply 进行加密。
返回 Reply Render 后的文本。
:param message: 一个 WeRoBot Message 实例。
:return: reply (纯文本)
"""
reply = self.get_reply(message)
if not reply:
... | python | def get_encrypted_reply(self, message):
"""
对一个指定的 WeRoBot Message ,获取 handlers 处理后得到的 Reply。
如果可能,对该 Reply 进行加密。
返回 Reply Render 后的文本。
:param message: 一个 WeRoBot Message 实例。
:return: reply (纯文本)
"""
reply = self.get_reply(message)
if not reply:
... | [
"def",
"get_encrypted_reply",
"(",
"self",
",",
"message",
")",
":",
"reply",
"=",
"self",
".",
"get_reply",
"(",
"message",
")",
"if",
"not",
"reply",
":",
"self",
".",
"logger",
".",
"warning",
"(",
"\"No handler responded message %s\"",
"%",
"message",
")... | 对一个指定的 WeRoBot Message ,获取 handlers 处理后得到的 Reply。
如果可能,对该 Reply 进行加密。
返回 Reply Render 后的文本。
:param message: 一个 WeRoBot Message 实例。
:return: reply (纯文本) | [
"对一个指定的",
"WeRoBot",
"Message",
",获取",
"handlers",
"处理后得到的",
"Reply。",
"如果可能,对该",
"Reply",
"进行加密。",
"返回",
"Reply",
"Render",
"后的文本。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L602-L618 | train | Get encrypted reply | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | BaseRoBot.check_signature | def check_signature(self, timestamp, nonce, signature):
"""
根据时间戳和生成签名的字符串 (nonce) 检查签名。
:param timestamp: 时间戳
:param nonce: 生成签名的随机字符串
:param signature: 要检查的签名
:return: 如果签名合法将返回 ``True``,不合法将返回 ``False``
"""
return check_signature(
self.conf... | python | def check_signature(self, timestamp, nonce, signature):
"""
根据时间戳和生成签名的字符串 (nonce) 检查签名。
:param timestamp: 时间戳
:param nonce: 生成签名的随机字符串
:param signature: 要检查的签名
:return: 如果签名合法将返回 ``True``,不合法将返回 ``False``
"""
return check_signature(
self.conf... | [
"def",
"check_signature",
"(",
"self",
",",
"timestamp",
",",
"nonce",
",",
"signature",
")",
":",
"return",
"check_signature",
"(",
"self",
".",
"config",
"[",
"\"TOKEN\"",
"]",
",",
"timestamp",
",",
"nonce",
",",
"signature",
")"
] | 根据时间戳和生成签名的字符串 (nonce) 检查签名。
:param timestamp: 时间戳
:param nonce: 生成签名的随机字符串
:param signature: 要检查的签名
:return: 如果签名合法将返回 ``True``,不合法将返回 ``False`` | [
"根据时间戳和生成签名的字符串",
"(",
"nonce",
")",
"检查签名。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L620-L631 | train | Check if the signature is correct. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/robot.py | WeRoBot.run | def run(
self, server=None, host=None, port=None, enable_pretty_logging=True
):
"""
运行 WeRoBot。
:param server: 传递给 Bottle 框架 run 方法的参数,详情见\
`bottle 文档 <https://bottlepy.org/docs/dev/deployment.html#switching-the-server-backend>`_
:param host: 运行时绑定的主机地址
:para... | python | def run(
self, server=None, host=None, port=None, enable_pretty_logging=True
):
"""
运行 WeRoBot。
:param server: 传递给 Bottle 框架 run 方法的参数,详情见\
`bottle 文档 <https://bottlepy.org/docs/dev/deployment.html#switching-the-server-backend>`_
:param host: 运行时绑定的主机地址
:para... | [
"def",
"run",
"(",
"self",
",",
"server",
"=",
"None",
",",
"host",
"=",
"None",
",",
"port",
"=",
"None",
",",
"enable_pretty_logging",
"=",
"True",
")",
":",
"if",
"enable_pretty_logging",
":",
"from",
"werobot",
".",
"logger",
"import",
"enable_pretty_l... | 运行 WeRoBot。
:param server: 传递给 Bottle 框架 run 方法的参数,详情见\
`bottle 文档 <https://bottlepy.org/docs/dev/deployment.html#switching-the-server-backend>`_
:param host: 运行时绑定的主机地址
:param port: 运行时绑定的主机端口
:param enable_pretty_logging: 是否开启 log 的输出格式优化 | [
"运行",
"WeRoBot。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/robot.py#L665-L689 | train | run bottle server | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/postgresqlstorage.py | PostgreSQLStorage.get | def get(self, id):
"""
根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
"""
cur = self.conn.cursor()
cur.execute("SELECT value FROM WeRoBot WHERE id=%s LIMIT 1;", (id, ))
session_json = cur.fetchone()
if session_json is N... | python | def get(self, id):
"""
根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
"""
cur = self.conn.cursor()
cur.execute("SELECT value FROM WeRoBot WHERE id=%s LIMIT 1;", (id, ))
session_json = cur.fetchone()
if session_json is N... | [
"def",
"get",
"(",
"self",
",",
"id",
")",
":",
"cur",
"=",
"self",
".",
"conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"SELECT value FROM WeRoBot WHERE id=%s LIMIT 1;\"",
",",
"(",
"id",
",",
")",
")",
"session_json",
"=",
"cur",
".",
... | 根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象 | [
"根据",
"id",
"获取数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/postgresqlstorage.py#L41-L53 | train | get a specific id from the database | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/postgresqlstorage.py | PostgreSQLStorage.delete | def delete(self, id):
"""
根据 id 删除数据。
:param id: 要删除的数据的 id
"""
self.conn.cursor().execute("DELETE FROM WeRoBot WHERE id=%s", (id, ))
self.conn.commit() | python | def delete(self, id):
"""
根据 id 删除数据。
:param id: 要删除的数据的 id
"""
self.conn.cursor().execute("DELETE FROM WeRoBot WHERE id=%s", (id, ))
self.conn.commit() | [
"def",
"delete",
"(",
"self",
",",
"id",
")",
":",
"self",
".",
"conn",
".",
"cursor",
"(",
")",
".",
"execute",
"(",
"\"DELETE FROM WeRoBot WHERE id=%s\"",
",",
"(",
"id",
",",
")",
")",
"self",
".",
"conn",
".",
"commit",
"(",
")"
] | 根据 id 删除数据。
:param id: 要删除的数据的 id | [
"根据",
"id",
"删除数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/postgresqlstorage.py#L73-L80 | train | Delete a werobot from the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/contrib/bottle.py | make_view | def make_view(robot):
"""
为一个 BaseRoBot 生成 Bottle view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!'
from bottle import Bottle
from werobot.contrib.bottle import ... | python | def make_view(robot):
"""
为一个 BaseRoBot 生成 Bottle view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!'
from bottle import Bottle
from werobot.contrib.bottle import ... | [
"def",
"make_view",
"(",
"robot",
")",
":",
"def",
"werobot_view",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"robot",
".",
"check_signature",
"(",
"request",
".",
"query",
".",
"timestamp",
",",
"request",
".",
"query",
".",
"... | 为一个 BaseRoBot 生成 Bottle view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
return 'Hello World!'
from bottle import Bottle
from werobot.contrib.bottle import make_view
app = Bottle()
... | [
"为一个",
"BaseRoBot",
"生成",
"Bottle",
"view。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/contrib/bottle.py#L12-L63 | train | A function that returns a bottle view that can be used to view a specific wekite. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/parser.py | process_message | def process_message(message):
"""
Process a message dict and return a Message Object
:param message: Message dict returned by `parse_xml` function
:return: Message Object
"""
message["type"] = message.pop("MsgType").lower()
if message["type"] == 'event':
message["type"] = str(message... | python | def process_message(message):
"""
Process a message dict and return a Message Object
:param message: Message dict returned by `parse_xml` function
:return: Message Object
"""
message["type"] = message.pop("MsgType").lower()
if message["type"] == 'event':
message["type"] = str(message... | [
"def",
"process_message",
"(",
"message",
")",
":",
"message",
"[",
"\"type\"",
"]",
"=",
"message",
".",
"pop",
"(",
"\"MsgType\"",
")",
".",
"lower",
"(",
")",
"if",
"message",
"[",
"\"type\"",
"]",
"==",
"'event'",
":",
"message",
"[",
"\"type\"",
"... | Process a message dict and return a Message Object
:param message: Message dict returned by `parse_xml` function
:return: Message Object | [
"Process",
"a",
"message",
"dict",
"and",
"return",
"a",
"Message",
"Object",
":",
"param",
"message",
":",
"Message",
"dict",
"returned",
"by",
"parse_xml",
"function",
":",
"return",
":",
"Message",
"Object"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/parser.py#L20-L34 | train | Process a message dict and return a Message object | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/mysqlstorage.py | MySQLStorage.set | def set(self, id, value):
"""
根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象
"""
value = json_dumps(value)
self.conn.cursor().execute(
"INSERT INTO WeRoBot (id, value) VALUES (%s,%s) \
ON DUPLICATE KEY UPDATE val... | python | def set(self, id, value):
"""
根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象
"""
value = json_dumps(value)
self.conn.cursor().execute(
"INSERT INTO WeRoBot (id, value) VALUES (%s,%s) \
ON DUPLICATE KEY UPDATE val... | [
"def",
"set",
"(",
"self",
",",
"id",
",",
"value",
")",
":",
"value",
"=",
"json_dumps",
"(",
"value",
")",
"self",
".",
"conn",
".",
"cursor",
"(",
")",
".",
"execute",
"(",
"\"INSERT INTO WeRoBot (id, value) VALUES (%s,%s) \\\n ON DUPLICATE KEY U... | 根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象 | [
"根据",
"id",
"写入数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/mysqlstorage.py#L72-L88 | train | set value for id | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/redisstorage.py | RedisStorage.get | def get(self, id):
"""
根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
"""
id = self.key_name(id)
session_json = self.redis.get(id) or '{}'
return json_loads(session_json) | python | def get(self, id):
"""
根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象
"""
id = self.key_name(id)
session_json = self.redis.get(id) or '{}'
return json_loads(session_json) | [
"def",
"get",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"key_name",
"(",
"id",
")",
"session_json",
"=",
"self",
".",
"redis",
".",
"get",
"(",
"id",
")",
"or",
"'{}'",
"return",
"json_loads",
"(",
"session_json",
")"
] | 根据 id 获取数据。
:param id: 要获取的数据的 id
:return: 返回取到的数据,如果是空则返回一个空的 ``dict`` 对象 | [
"根据",
"id",
"获取数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/redisstorage.py#L36-L45 | train | get 获取 id 要获取数据 | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/redisstorage.py | RedisStorage.set | def set(self, id, value):
"""
根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象
"""
id = self.key_name(id)
self.redis.set(id, json_dumps(value)) | python | def set(self, id, value):
"""
根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象
"""
id = self.key_name(id)
self.redis.set(id, json_dumps(value)) | [
"def",
"set",
"(",
"self",
",",
"id",
",",
"value",
")",
":",
"id",
"=",
"self",
".",
"key_name",
"(",
"id",
")",
"self",
".",
"redis",
".",
"set",
"(",
"id",
",",
"json_dumps",
"(",
"value",
")",
")"
] | 根据 id 写入数据。
:param id: 要写入的 id
:param value: 要写入的数据,可以是一个 ``dict`` 对象 | [
"根据",
"id",
"写入数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/redisstorage.py#L47-L55 | train | set value in the cache | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
offu/WeRoBot | werobot/session/redisstorage.py | RedisStorage.delete | def delete(self, id):
"""
根据 id 删除数据。
:param id: 要删除的数据的 id
"""
id = self.key_name(id)
self.redis.delete(id) | python | def delete(self, id):
"""
根据 id 删除数据。
:param id: 要删除的数据的 id
"""
id = self.key_name(id)
self.redis.delete(id) | [
"def",
"delete",
"(",
"self",
",",
"id",
")",
":",
"id",
"=",
"self",
".",
"key_name",
"(",
"id",
")",
"self",
".",
"redis",
".",
"delete",
"(",
"id",
")"
] | 根据 id 删除数据。
:param id: 要删除的数据的 id | [
"根据",
"id",
"删除数据。"
] | fd42109105b03f9acf45ebd9dcabb9d5cff98f3c | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/session/redisstorage.py#L57-L64 | train | delete a key from the cache | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pytorch/text | torchtext/vocab.py | Vocab.load_vectors | def load_vectors(self, vectors, **kwargs):
"""
Arguments:
vectors: one of or a list containing instantiations of the
GloVe, CharNGram, or Vectors classes. Alternatively, one
of or a list of available pretrained vectors:
charngram.100d
... | python | def load_vectors(self, vectors, **kwargs):
"""
Arguments:
vectors: one of or a list containing instantiations of the
GloVe, CharNGram, or Vectors classes. Alternatively, one
of or a list of available pretrained vectors:
charngram.100d
... | [
"def",
"load_vectors",
"(",
"self",
",",
"vectors",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"vectors",
",",
"list",
")",
":",
"vectors",
"=",
"[",
"vectors",
"]",
"for",
"idx",
",",
"vector",
"in",
"enumerate",
"(",
"vector... | Arguments:
vectors: one of or a list containing instantiations of the
GloVe, CharNGram, or Vectors classes. Alternatively, one
of or a list of available pretrained vectors:
charngram.100d
fasttext.en.300d
fasttext.simple.300d
... | [
"Arguments",
":",
"vectors",
":",
"one",
"of",
"or",
"a",
"list",
"containing",
"instantiations",
"of",
"the",
"GloVe",
"CharNGram",
"or",
"Vectors",
"classes",
".",
"Alternatively",
"one",
"of",
"or",
"a",
"list",
"of",
"available",
"pretrained",
"vectors",
... | 26bfce6869dc704f1d86792f9a681d453d7e7bb8 | https://github.com/pytorch/text/blob/26bfce6869dc704f1d86792f9a681d453d7e7bb8/torchtext/vocab.py#L117-L165 | train | Loads vectors from the input vectors. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.