Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth flow in Django Example: NameError: name 'is_naive' is not defined #325

Closed
ManuelBuri opened this issue May 6, 2021 · 2 comments
Closed
Labels
area:examples issues related to example or sample code bug Something isn't working

Comments

@ManuelBuri
Copy link

There is a NameError within the oAuth flow of the django example...

Reproducible in:
The slack_bolt version
django-slack-app==1.0.40
django-slack-oauth==1.5.0
slack-bolt==1.5.0
slack-sdk==3.5.1
slackclient==2.9.3

Python runtime version
Python 3.8.2

OS info
ProductName: macOS
ProductVersion: 11.1
BuildVersion: 20C69
Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101

Steps to reproduce:

python manage.py runserver

Expected result:

    def save(self, installation: Installation):
        i = installation.to_dict()
        if is_naive(i["installed_at"]):
            i["installed_at"] = make_aware(i["installed_at"])
        i["client_id"] = self.client_id
        SlackInstallation(**i).save()
        b = installation.to_bot().to_dict()
        if is_naive(b["installed_at"]):
            b["installed_at"] = make_aware(b["installed_at"])
        b["client_id"] = self.client_id
        SlackBot(**b).save()

Actual result:

NameError: name 'is_naive' is not defined

How do I define is_naive?

@seratch seratch closed this as completed in 33bb025 May 6, 2021
@seratch seratch added area:examples issues related to example or sample code bug Something isn't working labels May 6, 2021
@seratch
Copy link
Member

seratch commented May 6, 2021

@ManuelBuri Thanks for reporting this. When I updated the example recently, I failed to add required imports in models.py . Fixed by 33bb025

@ManuelBuri
Copy link
Author

@seratch may I ask how I can retrieve the email address of a user e.g. within the context of a message or event:

@app.message(":wave:")
def say_hello(message, say):
    user = message['user']
    say(f"Hi there, <@{user}>!")

or

# The echo command simply echoes on command
@app.command("/echo")
def repeat_text(ack, say, command):
    # Acknowledge command request
    ack()
    say(f"{command['text']}")

so that in the end I get the email address of a user that he/she used to register to slack ?

@seratch seratch changed the title oAuth flow in Django Example: NameError: name 'is_naive' is not defined OAuth flow in Django Example: NameError: name 'is_naive' is not defined Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:examples issues related to example or sample code bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants