[program-l] Re: python and flask

  • From: "Juan Hernandez" <juanhernandez98@xxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Thu, 15 Nov 2018 21:31:59 -0800

Uma,

 

I would love to check out your project.  Is it on github?

 

Best,

 

Juan

 

From: program-l-bounce@xxxxxxxxxxxxx <program-l-bounce@xxxxxxxxxxxxx> On Behalf 
Of Yuma Decaux
Sent: Thursday, November 15, 2018 7:30 PM
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: python and flask

 

Hey guys,

 

I'm not sure what system you guys use, but I'm working out a mac os version of 
a more accessible slack client, which is a sub section of an efficiently 
accessible trello desktop version I did, again for mac os.

 

Those web interfaces are actually starting to become cluttery and not 
efficient, especially when managing projects.

 

 

if anyone is interested in trying the trello one out, happy to share the repo.

 

 

 





On 16 Nov 2018, at 1:03 pm, Matthew Janusauskas <mjanusauskas@xxxxxxxxx 
<mailto:mjanusauskas@xxxxxxxxx> > wrote:

 

Hi Juan,

 

Sorry that I can’t be of much help with your question, but I would love to help 
with testing what you come up with. It would be great to have a more accessible 
desktop option for Slack as we have fully adopted it at my workplace.

 

Matthew

 





On Nov 15, 2018, at 8:28 PM, Juan Hernandez < 
<mailto:juanhernandez98@xxxxxxxxx> juanhernandez98@xxxxxxxxx> wrote:

 

Hi All,

 

I’m developing an alternative slack client that is far more accessible than the 
slack client that is released directly by slack.

 

One issue I’m having and this just because I haven’t done much in the past with 
Flask, is the instructions say to create a web server using flask for slack.

 

Here is the instructions at:   
<https://slackapi.github.io/python-slackclient/auth.html
https://slackapi.github.io/python-slackclient/auth.html

 

Now, here is my webserver.py file :

 

# controler / webserver.py

 

import os

from flask import Flask, request

from slackclient import SlackClient

import controler.config as cfg

 

app_oauth_scopes = [

    "client",

    "channels:read",

    "channels:write",

    "channels:history",

    "chat:read:user",

    "chat:write:user",

    "dnd:read",

    "dnd:write",

    "dnd:write:user",

    "emoji:read",

    "groups:history",

    "groups:read",

    "groups:write",

    "identity.basic",

    "identity.basic:user",

    " <im:history> im:history",

    " <im:read> im:read",

    " <im:write> im:write",

    "team:read",

    ]

 

client_id = cfg.slack_client_id

client_secret = cfg.slack_client_secret

 

app = Flask(__name__)

 

@app.route("/begin_auth", methods=["GET"])

def preinstall():

    return '''

        <a href=" <https://slack.com/oauth/authorize?scope=%7b0%7d&client_id=
https://slack.com/oauth/authorize?scope={0}&client_id={1}";>Sign In to Slack</a>

        '''.format(app_oauth_scopes, client_id)

 

        # end function begin_oauth

 

@app.route("/finish_auth", methods=["GET", "POST"])

def postinstall():

 

    # Retrieve the auth code from the request params

    auth_code = request.args['code']

 

    # An empty string is a valid token for this request

    sc = SlackClient("")

 

    # Request the auth tokens from Slack

    auth_response = sc.api_call(

        "oauth.access",

        client_id=client_id,

        client_secret=client_secret,

        code=auth_code

    )

 

    return auth_response

 

can someone please explain how this is to be used? In the past I’ve seen that 
applications launch a web browser, with a sign into slack button, and then it 
takes mme to slack.  How can I duplicate this process? How is this webserver 
used?  This is frustrating as my slack client is starting to come together.  
I’m testing with a ttest token, and now I want to release it to a test group so 
they can try it out.

 

Thanks for any help.

 

Other related posts: