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

Add support for smsapi.pl service backend #19

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

twkrol
Copy link

@twkrol twkrol commented May 3, 2021

New backend service: smsapi.pl (Polish SMS gateway service)

@roaldnefs roaldnefs self-requested a review May 3, 2021 13:16
Copy link
Owner

@roaldnefs roaldnefs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @twkrol for your contribution!

Would you be able to add tests and documentation for the newly added SMS backend? You can take the tests of the Twilio backend as an example, see:

class TwilioBackendTests(BaseSmsBackendTests, SimpleTestCase):

Please let me know if you need any help!

@twkrol
Copy link
Author

twkrol commented May 3, 2021

Ok, how to run the test locally?

@twkrol twkrol requested a review from roaldnefs May 3, 2021 14:25
@roaldnefs
Copy link
Owner

Ok, how to run the test locally?

After installing all dependencies you should be able to execute the tests using the python setup.py test command.

@twkrol
Copy link
Author

twkrol commented May 3, 2021

ready to go: documented & tested :)

twkrol added 2 commits May 3, 2021 17:16
Not elegant at the moment, but I need to get the results of sms sending.
@twkrol
Copy link
Author

twkrol commented May 3, 2021

Added a dirty thing: sending results, which I need to get after sms was sent (there is provider id of the message, status, etc)

    message.send_results = self.client.sms.send(
        to=recipient,
        message=message.body
    )

It works in real world, but the tests got it properly as error: there is no property of Message that could be set.

sms/backends/smsapi.py:54: error: "Message" has no attribute "send_results"

There are options:

  • extend Message class (as many django libraries do, eg. anymail) to include send_results property
  • another proposition to get sending status?

@twkrol
Copy link
Author

twkrol commented May 4, 2021

What if we add to the Message class a property called, say: 'raw_results'
Then any backend implementation can include it's own send result there, but the interpretation is transferred to the programmer if she/he wants to use that data.
What do you think @roaldnefs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants