-
Notifications
You must be signed in to change notification settings - Fork 20
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 Africa's talking adapter #70
Add Africa's talking adapter #70
Conversation
5bc08b6
to
b08a62e
Compare
@@ -21,7 +21,7 @@ def get_nurses_from_nc_registry(query): | |||
nurses = {'hits': [], 'total': 0} | |||
try: | |||
response = requests.get(url) | |||
if 'No results' in response.content: | |||
if b'No results' in response.content: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the "b" for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns the text in front of it into a bytes literal.
After updating the app to python3, it throws an error if 'No results' in response.content: TypeError: a bytes-like object is required, not 'str'
healthtools/settings.py
Outdated
AFRICASTALKING = { | ||
"SMS_AFRICASTALKING_USER": os.getenv("SMS_AFRICASTALKING_USER"), | ||
"SMS_AFRICASTALKING_KEY": os.getenv("SMS_AFRICASTALKING_KEY"), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to MTECH, some 3 things here:
- Let's have these as their own variables
- env variables must start with
HTOOLS_
- Use single quotes
healthtools/sms/__init__.py
Outdated
@@ -18,7 +18,7 @@ def process_sms(args, adapter='mtech'): | |||
# TODO: Track event SMS RECEIVED here | |||
|
|||
result, doc_type = run_query(msg) | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP 8 check.
healthtools/views/sms.py
Outdated
'phoneNumber': request.values.get('from'), | ||
'message': request.values.get('text') | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be done in the adapter itself similar to how we've achieved Twilio.
python-3.6.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andela-ookoro will add this changes in his PR that upgrades to python3
What's the |
…Tools.API into add-africas-talking-adapter with '#' will be ignored, and an empty message aborts the commit. with '#' will be ignored, and an empty message aborts the commit.
What does this PR do?
Add Africa's talking sms adapter to the application.
Description of Task to be completed?
Add functionality for SMS to work with Africa's Talking. issue #56
How should this be manually tested?
<host>/sms/africastalking
on Africa's talking.Screenshots (if appropriate)