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

Type error in facebook.py #5657

Closed
wavymazy opened this issue Apr 16, 2020 · 10 comments
Closed

Type error in facebook.py #5657

wavymazy opened this issue Apr 16, 2020 · 10 comments
Labels
area:rasa-oss/channels 📞 Issues focused around rasas input and output channels type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@wavymazy
Copy link

Hi,

I tried deploying the bot with Facebook and one error appears when I start a form:

TypeError: pop() takes at most 1 argument (2 given) (in rasa/core/channels/facebook.py : line 229).

I did a workaround but I thought you guys might want to take a look at this.

Cheers.

@sara-tagger
Copy link
Collaborator

Thanks for raising this issue, @tabergma will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗

@tabergma
Copy link
Contributor

Thanks for raising the issue @wavymazy. What is your current workaround?

@wavymazy
Copy link
Author

Hello,

Since the issue was that .pop("sender", {}) is expecting the json to be a dict, I just put in place a check to handle the case when it's a list.

async def send_custom_json(
    self, recipient_id: Text, json_message: Dict[Text, Any], **kwargs: Any
) -> None:
    """Sends custom json data to the output."""

    if isinstance(json_message, list):
        if isinstance(json_message.pop(), list):
            recipient_id = json_message.pop().pop() or recipient_id
        else:
            recipient_id = json_message.pop().pop("id", None) or recipient_id
    else:
        if isinstance(json_message.pop("sender", {}), list):
            recipient_id = json_message.pop("sender", {}).pop("id") or recipient_id
        else:
            recipient_id = json_message.pop("sender", {}).pop("id", None) or recipient_id

    self.messenger_client.send(json_message, recipient_id, "RESPONSE")

@tabergma
Copy link
Contributor

Great! As you already have a solution, do you want to contribute and create a PR?

@tabergma tabergma added area:rasa-oss 🎡 Anything related to the open source Rasa framework type:enhancement ✨ Additions of new features or changes to existing ones, should be doable in a single PR labels Apr 17, 2020
@silvasara
Copy link
Contributor

I am interested in working on this issue, is it still valid?

@tabergma
Copy link
Contributor

@silvasara I think it is. Feel free to pick it up 🚀

@tmbo tmbo added area:rasa-oss/channels 📞 Issues focused around rasas input and output channels and removed area:rasa-oss 🎡 Anything related to the open source Rasa framework labels Nov 17, 2020
@wochinge wochinge added type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. and removed type:enhancement ✨ Additions of new features or changes to existing ones, should be doable in a single PR labels Jan 29, 2021
@jppgomes
Copy link
Contributor

Hello, I checked the missing tests for the correction, can I implement and send the pr? @tabergma

wavymazy added a commit to wavymazy/rasa that referenced this issue Mar 21, 2021
wavymazy added a commit to wavymazy/rasa that referenced this issue Mar 21, 2021
@wavymazy wavymazy mentioned this issue Mar 22, 2021
4 tasks
wavymazy added a commit to wavymazy/rasa that referenced this issue Mar 22, 2021
wavymazy added a commit to wavymazy/rasa that referenced this issue Mar 22, 2021
wavymazy added a commit to wavymazy/rasa that referenced this issue Mar 22, 2021
@wavymazy wavymazy mentioned this issue Mar 22, 2021
4 tasks
wavymazy added a commit to wavymazy/rasa that referenced this issue Mar 29, 2021
@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 21, 2021
@ErickGiffoni
Copy link
Contributor

Is this issue still a problem ?
I am with a group of developers here that might want to solve it !

@ancalita
Copy link
Member

Solved by #9692 PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss/channels 📞 Issues focused around rasas input and output channels type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
9 participants