sym-sdk
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: sym-sdk | ||
| Version: 0.59.0a1 | ||
| Version: 0.59.0 | ||
| Summary: Sym's Python SDK | ||
@@ -5,0 +5,0 @@ Home-page: https://sdk.docs.symops.com/ |
+1
-1
| [tool.poetry] | ||
| name = "sym-sdk" | ||
| version = "v0.59.0-alpha1" | ||
| version = "v0.59.0" | ||
| description = "Sym's Python SDK" | ||
@@ -5,0 +5,0 @@ authors = ["Sym Engineering <pypi@symops.io>"] |
+1
-1
@@ -26,3 +26,3 @@ # -*- coding: utf-8 -*- | ||
| 'name': 'sym-sdk', | ||
| 'version': '0.59.0a1', | ||
| 'version': '0.59.0', | ||
| 'description': "Sym's Python SDK", | ||
@@ -29,0 +29,0 @@ 'long_description': 'Sym Python SDK\n================\n\n`Sym <https://symops.com/>`_ is the security workflow platform made for engineers, by engineers.\n\nWe solve the intent-to-execution gap between policies and workflows by providing fast-moving engineering teams with the just-right primitives to roll out best-practice controls.\n\nThis is the Python SDK for Sym.\nFor guides and other help, check out our `main docs site <https://docs.symops.com/>`_.\n\nThe SDK docs are broken into several core modules, which are described below.\nClick on one to see the classes and functions available in your `Handlers <https://docs.symops.com/docs/workflow-handlers>`_.\n\nThe Sym SDK is used to customize workflow templates that are exposed by our `Terraform provider <https://registry.terraform.io/providers/symopsio/sym/latest/docs>`_. Here\'s an example using the ``sym:approve`` Template!\n\n.. code-block:: python\n\n from sym.sdk.annotations import reducer\n from sym.sdk.integrations import pagerduty, okta, slack\n\n @reducer\n def get_approvers(evt):\n # The import here uses credentials defined in an Integration in Terraform\n if pagerduty.is_on_call(evt.user, schedule="id_of_eng_on_call"):\n # This is a self-approval in a DM\n return slack.user(evt.user)\n\n if evt.payload.fields["urgency"] == "Emergency":\n # This is a self-approval in a channel\n return slack.channel("#break-glass", allow_self=True)\n\n on_call_mgrs = okta.group("OnCallManagers").members()\n # This would cause each on-call manager to be DMed\n return slack.group([slack.user(x) for x in on_call_mgrs])\n\nIf you\'re interested in using Sym, please `reach out <https://symops.com/sales>`_!\n', |
| """Helpers for interacting with a Slack workspace.""" | ||
| from typing import List, Optional, Sequence, Union | ||
| from typing import Optional, Sequence, Union | ||
@@ -114,2 +114,14 @@ from sym.sdk.exceptions.slack import SlackError # noqa | ||
| def send_thread_message(message: str) -> None: | ||
| """Sends a simple message as a threaded reply to the current request message in Slack. | ||
| Args: | ||
| message: The text contents of the message to send. | ||
| Raises: | ||
| SlackError: If the current request was not sent to Slack via `get_request_notifications` or `get_approvers`, | ||
| so there is no message to reply to. | ||
| """ | ||
| def get_user_info(user: User) -> dict: | ||
@@ -151,53 +163,1 @@ """Get information about a Slack user. | ||
| """ | ||
| def users_in_channel(channel: Union[SlackChannelID, SlackChannelName, str]) -> List[User]: | ||
| """Retrieves the users in a given Slack channel as a list of :class:`~sym.sdk.user.User` objects. | ||
| "Channel" here includes all Slack conversation types, including public and private channels as well as groups. | ||
| The ``channel`` argument can either be given as the output of the :func:`~sym.sdk.integrations.slack.channel` | ||
| function, or as a string containing a Slack channel name or ID. If a channel name is given in a string, it must be | ||
| prefixed with ``#``. | ||
| The output is a list of :class:`~sym.sdk.user.User` objects, suitable for use in other areas of the Sym SDK. For | ||
| example, to easily restrict the ability to approve or deny requests (including in the Sym webapp) to members of a | ||
| Slack channel, one can use:: | ||
| @reducer | ||
| def get_permissions(event): | ||
| return RequestPermission( | ||
| webapp_view=PermissionLevel.MEMBER, | ||
| approve_deny=user_ids(slack.users_in_channel("#managers")), | ||
| allow_self_approval=False | ||
| ) | ||
| However, please see the "Cautions" below for some important caveats when using this function. | ||
| (For more information on the ``get_permissions()`` reducer, please see `the docs | ||
| <https://docs.symops.com/docs/reducers#get_permissions>`_.) | ||
| **Cautions:** | ||
| - Using this function introduces a hard dependency on Slack in your Sym Flow, which may have unintended effects; for | ||
| example, during a Slack outage when the Slack API is unavailable. If you must use this function in such a way, | ||
| wrap the call in a ``try``/``except`` block and include backup logic in the ``except`` block. In the above | ||
| example, you may wish to set ``approve_deny=PermissionLevel.ADMIN`` in the ``except`` block, for instance, so that | ||
| admins can still action requests in the webapp even if Slack is down. | ||
| - This function may cause your Flow to experience a reducer timeout for large Slack channels. Test your usage to | ||
| ensure that it works as expected. | ||
| - To use this function with a private channel, the Sym Slack bot must be a member of that channel; otherwise, this | ||
| function will raise a channel not found exception. | ||
| - If this function is used with a Slack Connect channel or in a channel containing Slack guest users, any users from | ||
| outside your organization *will* be included in the output. | ||
| Args: | ||
| channel: A ``SlackChannelID``, ``SlackChannelName``, or string representing the channel ID or name. | ||
| Returns: | ||
| A list of User objects representing the users in the channel, or an empty list if the channel is empty. | ||
| Raises: | ||
| :class:`~sym.sdk.exceptions.slack.SlackError`: If the channel is not found or another error occurs while | ||
| interacting with the Slack API. | ||
| """ |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
187771
-1.31%3728
-0.82%