Saravanan666/pypi-org huggingface dataset:
Package: slack-tangerine
A Flask inspired, decorator based API wrapper for Python-Slack.AboutTangerine is a lightweight Slackbot framework that abstracts away all the boilerplate code required to write bots, allowing you to focus on the problem at hand.InstallationTo install tangerine, simply use pipenv (or pip, of course):$pipenvinstallslack-tangerineCreate a new file with the following contents:# mybot.pyfromtangerineimportTangerinetangerine=Tangerine("xoxb-1234567890-replace-this-with-token-from-slack")@tangerine.listen_for('morning')defmorning(user,message):return"mornin' @{user.username}"if__name__=='__main__':tangerine.run()Now try running it, run the following command then say "morning" in Slack.pythonmybot.pyUsageTo start your project, you'll first need to import tangerine by adding from tangerine import Tangerine to the top of your file.Next you'll need to create an instance of Tangerine and configure your Slack token. This can be done using a yaml config file or passing it explicitly to the initialization.# Option 1: YAML config:importosfromtangerineimportTangerinepath=os.path.dirname(os.path.abspath(__file__))path_to_yaml=os.path.join(path,'config.yaml')tangerine=Tangerine.config_from_yaml(path_to_yaml)# Option 2: Hardcoded slack tokenfromtangerineimportTangerinetangerine=Tangerine("xoxb-1234567890-replace-this-with-token-from-slack")Now its time to write your response functions, these functions get wrapped with the listen_for decorator, which registers a pattern to watch the slack conversation for and which python method should handle it once its said.In the following example, the method is setup to listen for the word "cookies". Notice that the decorator passes two arguments to the function, first the user object which contains information about the user who triggered the event (in this case the Slack user who said the word cookies) and message, which is a string of the complete message.@tangerine.listen_for('cookies')defcookies(user,message):# do something when someone say's "cookies" here.CrontabSometimes you'll run into situations where you want Slack messages to be sent periodically rather than in direct response to a keyword, for this Tangerine ships with a single-threaded Python implementation of Cron.Let's pretend we want to send a message to everyone in a channel every five minutes, simply add the following to your mybot.py file:@tangerine.cron('*/5 * * * *')defsome_task():tangerine.speak("Hay Ride!","#general")
Package: slacktastic
slackisticsPackage to send Statistics over a Slack Incoming WebhookFree software: MIT licenseFeaturesSend messages via Slack Incoming WebhookProvides object-based templates for Messages, Attachments and FieldsFine-grained control over Message formatting, and supports mrkdwnEasily generate various charts based on your data. Supported types are:Bar ChartLine ChartRadar ChartPie ChartOuter Pie ChartDonut ChartRadial GaugeRoadmapImplement testsAdd extensive documentationAdd support for more chart typesAdd templates for most commonly sent messagesExtend customisation to override webhook settingsCreditsInspiration for this package occurred while trying to send statistics for projects in a uniform way to Slack channels forLabel A.This package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.This package makes use of theQuickchart.ioto draw diagrams.Usagefromslacktastic.clientimportSlackClientfromslacktastic.templateimportAttachment,PieChart,Messageclient=SlackClient(webhook_url='YOUR WEBHOOK URL')attachment=Attachment(title='Cool block title',title_link='https://labela.nl',text='Some awesome text')chart=PieChart(title="Test data",labels=['Ride','Reservation'],values=[22,55])# You can now pass custom ChartJS options for all diagrams! See ChartJS docschart.set_options({title:{display:true,text:'Cool title',fontColor:'hotpink',# For testing purposes only...fontSize:32,})another_chart=BarChart("Test data",labels=['Jan','Feb','Mar','Apr','May'],data={'Test 1':[1,2,4,8,16],'Test 2':[7,3,45,1,12],})# Customise the background colors of your data if you don't like our schemeanother_chart.set_background_colors(["#000","#3333","#666","#999","#CCC"])message=Message(text="I want to show you some *magic* :sparkles:",attachments=[attachment,chart])client.send_message(message)History0.3.2 (2019-08-01)Added RadialGauge diagram0.3.1 (2019-08-01)Added OuterPieChart, the Pie chart with labels on the outside!0.3.0 (2019-07-31)Reworked class inheritance to limit amount of parameters passed aroundChanged default background colors for all graphsAdded possibility supply own background colors for all graph typesChanged default label text on FoodChart diagrams such as Pie and Donut to make it more readableAdded possibility to override options of diagrams for fine grained control. Does not impose any restrictions currently!0.2.3 (2019-07-31)Updated documentation: added roadmap and features0.2.2 (2019-07-30)Removed invalid documentation link0.2.1 (2019-07-30)Added support for Donut, Bar, Line and Radar chartsUpdated documentation0.1.0 (2019-07-25)First release on PyPI.
Package: slack-timezoner
Slack TimezonerIf you use slack, it's sometimes useful to get an idea of the geographic distribution of members.And because we're online, while geographic distance is important to know it's often the timezone that's more relevant for working out when might be sensible to contact someone, or see how a commmunity is distributed.This is what slack timezoner does. Right now all it does is print out a count of members in your community, by timezone.## UsageCreate an app for a single slack groupGet a Web API token -https://api.slack.com/web#authenticationCheckout this codeInstall dependenciesEither use the code programatically, or run it this as a server, to see the JSON outputCreate an appYou need to create an app for a single team. See below for morehttps://slack.dev/python-slackclient/auth.html#You can create an app at the link below:https://api.slack.com/appsGet a web api tokenThis is detailed in slack's extensive documentation. You need a Web API tokenhttps://api.slack.com/web#authenticationIf it helps it should be visible at a link that looks like the pattern below, and it will be calledOAuth Access Tokenin the web UI:https://api.slack.com/apps/YOUR_APP_ID/oauthCheck out this codeUse the code programatically, or run the serverThis project includes a minimal, single-file Django app, to serve the summary as JSON, to display using some charting or tabular renderer.python ./minimal.py runserverAlternatively, you can also import the library and use it programatically in python code:import slack_timezoner.group_by_timezones

tzc = group_by_timezones.TimeZoneCounter()

# returns a Counter datastructure
res = tzc.summary()Next stepsThis was thrown together in a hurry, and I'd like to adapt this to allow running the same kind of summaries for any public channel in slack workspace.You can list all the channels in workspace with this API call:https://api.slack.com/methods/conversations.listOnce you have that, you can get a list of the members like so:https://api.slack.com/methods/conversations.membersThis returns a list of member ids like so:{
    "ok": true,
    "members": [
        "U023BECGF",
        "U061F7AUR",
        "W012A3CDE"
    ],
    "response_metadata": {
        "next_cursor": "e3VzZXJfaWQ6IFcxMjM0NTY3fQ=="
    }
}You can then look up the timezones, with this call to recontruct a datastructure similar to the one used in the TimeZoneCounter already.https://slack.dev/python-slackclient/basic_usage.html#listing-team-membersContributingThis is currently used in the ClimateAction.tech slack. If you're interested in helping out, please file an issue, or join the slack there.You can join the link below:https://climateaction.tech/#join
Package: slacktokens
SlackTokensExtract personal tokens and authentication cookie from the Slack app, to use with the Slack API.Descriptionslacktokensis a tool for providing programmatic access to theSlackecosystem.This project is not endorsed or authorised in any way by Slack Technologies LLC.The Slack API is how all Slack clients, including the official desktop app and third-party
bots, read and write data that constitutes the Slack user experience. All clients much
provide authorisation to access the API.As of July 2021, individual user access to the Slack API (as opposed to bot access) is
granted by providing a personal token (beginning withxoxc-) and a cookie calledd.
Each Slack Workspace has its own personal token, but the cookie is the same for all.If you use the Slack desktop app, these details will be stored on your local machine.
This script extracts them from the app's local store so you can use them for purposes not
provided for by the app itself.UsageCallingget_tokens_and_cookie()will return the necessary authorisation details as a
Python dictionary, in the following format:{
  'tokens': [
    'Workspace name': { token: <personal-token>, url: <URL of Workspace> }
    ]
  'cookie': { 'name': 'd', 'value': <value-of-d-cookie> }
}This data can be used for calls to the Slack API. For example:curl 'https://slack.com/api/team.info?token=<personal-token>' --header 'Cookie: d=<value-of-d-cookie>'DetailsYour personal tokens are extracted by querying the Slack app's HTML Web Storage database. The token for each Workspace is stored in a dictionary in thelocalStorageobject, in aLevelDBdatabase. The useful fields extracted from the dictionary, other than the token itself, are the human readable Workspace name, and the Workspace URL.The cookie is extracted from the Slack app's cookie store. The cookie of interest is
stored encrypted, so a modified version ofpycookiecheatis used to decrypt the
contents. The decryption process will prompt you for your user password, which is used
only to pull out the cookie store encryption secret from your keychain.ShortcomingsmacOS and Linux only.Windows support contributions welcome.Slack Desktop App only.Browser support contributions welcome. Preferred implementation: failover to looking through browsers if the app access method fails.Might require the app to be closed, because LevelDB is not a multi-user database and there are no read-only access options.No established method for persisting the token data. Thought long and hard about this, and decided to keep the interface flexible and to leave suitable persistance methods as an exercise for the user.It turns out the script is fast and read-only, so if the user is another Python script, then perhaps no persistance is required.
Package: slacktools
A toolbelt for working with the variousSlack APIsin python.InstallInstall slacktools withPyPIpipinstallslacktoolsThis library is tested against Python 3.4+.Open an issueif you need this library to work on an older version.FeaturesAuthorization utilsto verifyX-Slack-SignatureMessage text utilsto do things like:Format slack control sequences like<@USERIDXX>and<text|url>with proper escapingExtract mentions and grab user ids from mentionsProperly escape message textMessage sending functionswith partial application to reduce boilerplate
and improve testabilitySilly stuffCheck outthe docsfor more info andAPI documentation.TestsRunning the tests is simple enough:pythonsetup.pytestOr justpytestwill do the trick. This will run the tests in thetests/directory as well as as bunch of docstring tests in thesrc/directory.The Makefile also has some good test commands that will spin up a docker container:make testwill run the tests in python 3.7.maketest-allwill run a series of tests from python 3.7 down to 3.4.maketest-{{PY_VERSION}}wherePY_VERSIONcan beany tagged version
of the official python docker imagewill run tests under that python
version. Ex:maketest-3.5will run under Python 3.5.RoadmapWider python support? This lib onlysupports python 3right
now. However, if someone needs it, I can add python 2 compatibility.Friendly message builder API?Build deep links into clientsIn the Wildaustinpray/kizunais a silly chatbot thatuses this library.
Package: slacktools-blockkit
slacktools-blockkitslacktools-blockkit provides an expressive interface for utilizing the Slack Block-kit UI framework.Features:Build Slack UIs by composing classes instead of manually constructing dictionaries.Easily parse action payloads and modal submission payloads without manual dictionary traversal.Compose your own reusable blocks with fixed attributes and avoid magic string lookups when parsing interactive payloads.Installation:pip install slacktools-blockkitBasic Usage:fromblockkitimportMessage,blocks,elements,objectsmessage=Message(blocks=[blocks.Section(objects.MrkdwnText("*User Information: ")),blocks.Divider(),blocks.Section(objects.PlainText("John Doe"),fields=[objects.MrkdwnText("Address:\n"),objects.PlainText("123 Street, City, 11111"),objects.MrkdwnText("Phone:\n"),objects.PlainText("111-111-1111")]),blocks.Actions(elements=[elements.Button(action_id="delete",text="Delete User",style=elements.Button.Styles.DANGER)])])Parsing action payloads:fromblockkitimportelementsvalue=elements.Button.parse_value(action_payload["actions"][0])Basic view submission payload parsing:Define the view:fromblockkitimportblocks,views,objectsmodal=views.Modal(title="User Data",blocks=[blocks.Section(objects.PlainText("Enter user information:")),blocks.PlainTextInput(label="Username",block_id="user_data",action_id="username")])Parse the response:fromblockkitimportblocksvalue=blocks.PlainTextInput.parse(view_payload,block_id="user_data",action_id="username")Fixed blocks and view submission payload parsing:Define the fixed block and view:fromblockkitimportblocks,views,objectsfromblockkit.fixed_blocksimportFixedPlainTextInputclassUsernameInput(FixedPlainTextInput):block_id="user_data"action_id="username"label="Username"modal=views.Modal(title="User Data",blocks=[blocks.Section(objects.PlainText("Enter user information:")),UsernameInput()])Parse the response:value=UsernameInput.parse(view_payload)
Package: slacktools-commands
slacktools-commandsA simple framework for working with Slack slash-commands (https://api.slack.com/interactivity/slash-commands).Register you customCommandclass with theComandFactoryand when you receive a command request from Slack simply grab the command instance from the
factory and execute it.Installpip install slacktools-commandsBasic UsageDefine your command:fromcommandsimportregister_command,Command,CommandValidationErrorfrommyprojectimportget_status,post_status@register_command("/status")classStatusCommand(Command):def_validate(self):ifnotget_status(id=self.payload.text):raiseCommandValidationError("Not a valid id.")def_execute(self):post_status(id=self.payload.text)Handle the Slack command request:fromrest_framework.viewsimportAPIViewfromrest_framework.responseimportResponsefromcommandsimportCommandFactoryclassCommandsView(APIView):defpost(self,request):command=CommandFactory.make_commmand(request.data)command.execute()returnResponse()Action CommandsAction commands allow you execute many different actions from a single Slack command. The text following
the command is used to determine which action should be performed. The text is split by spaces, the first character
set determines the action and the remain character sets are passed to the action as options/parameters.ExampleThe below class definitions will handle the following command:/status service apifromcommandsimportActionCommand,Action,CommandValidationError,register_commandfrommyprojectimportpost_status_msgclassServiceStatus(Action):defvalidate(self):iflen(self.options)==0:CommandValidationError(self.payload,"Missing service name")defexecute(self):post_status_msg(self.options[0])@register_command("/status")classStatusCommand(ActionCommand):ACTIONS={"service":ServiceStatus}
Package: slacktools-interactivity
slacktools-interactivityA simple framework for working with Slack interactivity (https://api.slack.com/interactivity).Installpip install slacktools-interactivityCommandsRegister yourCommandHandlerclass with theComandFactoryand when you receive a
command request from Slack simply grab the command instance from the factory and execute it.Basic UsageDefine your command:frominteractivityimportCommandFactory,CommandHandler,CommandValidationErrorfrommyprojectimportget_status,post_status@CommandFactory.register("/status")classStatusCommand(CommandHandler):def_validate(self):ifnotget_status(id=self.payload.text):raiseCommandValidationError("Not a valid id.")def_execute(self):post_status(id=self.payload.text)Handle the Slack command request:fromrest_framework.viewsimportAPIViewfromrest_framework.responseimportResponsefrominteractivityimportCommandFactoryclassCommandsView(APIView):defpost(self,request):handler=CommandFactory.make_handler(request.data)handler.execute()returnResponse()Action CommandsAction commands allow you execute many different actions from a single Slack command. The text following
the command is used to determine which action should be performed. The text is split by spaces, the first character
set determines the action and the remain character sets are passed to the action as options/parameters.ExampleThe below class definitions will handle the following command:/status service apifrominteractivityimport(ActionCommandHandler,CommandAction,CommandValidationError,CommandFactory)frommyprojectimportpost_status_msgclassServiceStatus(CommandAction):defvalidate(self):iflen(self.options)==0:CommandValidationError(self.payload,"Missing service name")defexecute(self):post_status_msg(self.options[0])@CommandFactory.register("/status")classStatusCommand(ActionCommandHandler):ACTIONS={"service":ServiceStatus}ViewsTo documentActionsTo document
Package: slacktools-slackfixtures
slacktools-slackfixturesA pytest plugin that adds useful fixtures for testing Slack integrations.Install:pip install slacktools-slackfixturesExample usage:frommyapp.tasksimportpost_messagedeftest_post_message(mock_slack):response_data={"status":"OK"}slack=mock_slack(path="myapp.tasks.slack",method="chat_postMessage",response_data=response_data)response=post_message()slack.chat_postMessage.assert_called_once()assertresponse.data==response_dataTest for failure:importpytestfromslack.errorsimportSlackApiErrorfrommyapp.tasksimportpost_messagedeftest_post_message_failure(mock_slack):response_data={"status":"Not OK"}slack=mock_slack(path="myapp.tasks.slack",method="chat_postMessage",response_data=response_data,validates=False)response=post_message()withpytest.raises(SlackApiError):response.validate()
Package: slacktory
SlacktoryA decorator which is called using:@slacktory.watch('the text to watch for')...that watches a specified Slack channel fornewSlack message posts whose ['text'] value is equivalent to the provided string argumentRequiresPython 3.7InstallationpipinstallslacktoryFor this decorator to work, you must first create aSlack AppThen create alocal_settings.pyfile in your project's root directory with the following content:name='<your Slack channel name>'channel='<your Slack channel id>'token='<your Slack API token>'webhook='<your Slack channel webhook>'All of the above information can be obtained when setting up yourSlack AppUsage example>>>importslacktory>>>@slacktory.watch('do the thing')# the decorator>>>defthe_thing():# do something here...In the above example, the_thing() will be called once the @slacktory.watch decorator has detected the text 'do the thing' in a new Slack message in the Slack channel (specified inlocal_settings.py).Release History1.0.0first release1.0.1minor README changes1.0.2minor README changes1.0.3use nonlocal variables to remove the need for a recursive call on decorated functionremove polling, add while True1.0.4Add try/except with error message for import local_settingsAdd license copy1.0.5add exception handlingMetaJames Coleman –jamescoleman@me.comDistributed under the MIT license. SeeLICENSEfor more information.gitlab.com/jamescoleman/slacktoryContributingFork it (https://gitlab.com/j9mes/slacktory/forks/new)Create your feature branch (git checkout -b feature/fooBar)Commit your changes (git commit -am 'Add some fooBar')Push to the branch (git push origin feature/fooBar)Create a new Pull Request
Package: slack-transfer
slack_transferDocumentations & User Guidesslack_transfer is a tool for transferring messages to the other slack workspace.Documentations are available onreadthedoc.User guide (en)ユーザーガイド (日本語)InstallThis package is available on pypi asslack-transfer$pipinstallslack-transfer
$python
>>importslack_transferPlease note that you have to userslack_transferinstead ofslack-transferfor importing.Issues and ContributionAbout issues (bugs):You can report issueshere.日本語でissueを立てて構いません．There are no guarantee to support or fix those issues.Contributions:You can send pull requests (PRs) to this repository.But, there are no guarantee to merge your PRs.
Package: slack-tunes
send slack music notifications from itunes or spotifyRequirementsOS XiTunes or SpotifyInstallationUsing PIP via PyPI:pip install slack-tunesUsing PIP via Github:pip install git+https://github.com/josegonzalez/python-slack-tunes.git#egg=slack-tunesUsageExport aSLACK_API_TOKEN, as shown on theirtokens page, and then execute the binary:exportSLACK_API_TOKEN="YOUR_TOKEN"slack-tunesSlack tunes will run in the foreground, and can be terminated at any time. It will update the status at most every 10 seconds, and will clear your status if no music is playing.You can also specify multiple tokens via comma-delimiter. This is useful for notifying multiple slack teams.exportSLACK_API_TOKEN="YOUR_TOKEN,YOUR_OTHER_TOKEN"slack-tunes
Package: slack-types
Slack API typesSee:https://pypi.org/project/slack-typesThis npm package is a collection of Python and TypeScript type definition of Slack APIs.Currently, the package support the following APIs.API Methods (web-api)Events API (events-api)Real Time Messaging API (rtm-api)Incoming payloads from Slack Platform (app-backend)Dialogs (dialog_submission, cancellation, suggestion)Interactive Messages (interactive_message, block_action)Message Actions (message_action)Slash CommandsHow to useFor Python:fromtypingimportCallable# Requirement: install aiohttpfromslack_bolt.async_appimportAsyncAppfromslack_sdk.web.async_clientimportAsyncWebClientfromslack_types.events_api.app_mention_payloadimportEventasAppMentionEventapp=AsyncApp()@app.event("app_mention")asyncdefhandle_mentions(event:dict[str,str],client:AsyncWebClient,say:Callable):# async functionslack_mention=AppMentionEvent.from_dict(event)api_response=awaitclient.reactions_add(channel=slack_mention.channel,timestamp=slack_mention.ts,name="eyes",)awaitsay("What's up?")if__name__=="__main__":app.start(3000)For TypeScript:import*asexpressfrom'express';import{Express,Request,Response}from'express';import*asSlackfrom'@slack/web-api';import*asWebApifrom'seratch-slack-types/web-api';import*asEventsApifrom'seratch-slack-types/events-api';exportconstslackApi=newSlack.WebClient(process.env.SLACK_API_TOKEN);exportconstapp:Express=express();app.post('/events',function(req:Request,res:Response){constbody=JSON.parse(req.body);// still "any" hereif(body.type==='url_verification'){// url verificationres.status(200).send(body.event.challenge);}elseif(body.type==='event_callback'&&body.event.type==='message'){// still "any" hereconstpayload=bodyasEventsApi.MessagePayload;// `payload.event.text` here is typesafeslackApi.api.test({text:payload.event.text}).then((response:WebApi.ApiTestResponse)=>{// `response` is typesafeif(response.ok){// do something here}else{// do something here}}).catch(reason=>{// do something here});}else{// do something here}res.status(200).json({message:'thanks!'});});How are the types generatedThese types are generated from jSlack library's type definitions in Java + actual JSON responses fetched by running jSlack's unit tests. If you're interested in the details, take a look atjSlack.The coverage may not be 100% yet. A portion of the properties may be incorrect. If you find missing properties or something wrong, let us know here:https://github.com/seratch/seratch-slack-types/issuesTo re-generate:$npminstall
$npmrunbuildLicenseThe MIT License