Skip to content

Adding Code Snippets #63

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

Merged
merged 12 commits into from
Mar 3, 2020
Merged

Adding Code Snippets #63

merged 12 commits into from
Mar 3, 2020

Conversation

superdiana
Copy link
Contributor

No description provided.

@superdiana superdiana changed the title Send Signed SMS Adding Code Snippets: Send Signed SMS, Create Secret Feb 28, 2020
key = os.getenv('NEXMO_API_KEY'),
secret = os.getenv('NEXMO_API_SECRET'),
signature_secret = os.getenv('NEXMO_SIGNATURE_SECRET'),
signature_method = 'md5'
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a difference between md5 hash and HMAC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, HMAC needs a cryptographic function like md5, sha1 to make the calculations... In other words HMAC depends on a cryptographic functions and other variables like a secret. Is there a specific requirement for either? i just went with md5 as the standard.

#Init the client
client = nexmo.Client(
key = os.getenv('NEXMO_API_KEY'),
secret = os.getenv('NEXMO_API_SECRET'),
Copy link
Contributor

Choose a reason for hiding this comment

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

They shouldn't need to add an API Secret if they're signing (the signature acts as the auth)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Took after the other code snippet models. My bad. Cleaning up

@dragonmantank
Copy link
Contributor

On a side note, Python still need support for all the hashing algorithms, so might be a good idea to fully do this after we add those in.

@superdiana
Copy link
Contributor Author

To use the async variant of the number insight a change in the get_advanced_number_insight Client method is needed.

For example, proposing:

def get_advanced_number_insight(self, params=None, **kwargs):
    argoparams = params or kwargs
    if "callback" in argoparams:
        return self.get(self.api_host, "/ni/advanced/async/json", params or kwargs)
    else:   
        return self.get(self.api_host, "/ni/advanced/json", params or kwargs)```

I tested with the no callback param and is working too, and it works like a charm. Will submit a pr for that too

@superdiana superdiana changed the title Adding Code Snippets: Send Signed SMS, Create Secret Adding Code Snippets Mar 1, 2020
@afolson afolson merged commit 1782871 into Vonage:master Mar 3, 2020
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.

4 participants