Skip to content

Add new building blocks. #23

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 17 commits into from
May 24, 2018
Merged

Add new building blocks. #23

merged 17 commits into from
May 24, 2018

Conversation

tbedford
Copy link
Contributor

@tbedford tbedford commented May 1, 2018

This should be the code for the 'connect an inbound call' building block. Hopefully it's the format you require.

@tbedford tbedford requested review from judy2k and sammachin May 1, 2018 10:56
@sammachin
Copy link

Needs a from in the connect action which should be your NEXMO_NUMBER
The to should be RECIPIENT_NUMBER
I prefer functions without blank lines in them eg L8 but I'm sure Mark will say that's not proper python!

@tbedford tbedford changed the title Added connect an inbound call building block. Added building blocks. May 2, 2018
@tbedford tbedford changed the title Added building blocks. Add new building blocks. May 2, 2018
Copy link
Contributor

@judy2k judy2k left a comment

Choose a reason for hiding this comment

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

A couple of minor things I'd like to be discussed or fixed - otherwise great work! I love working with other Python devs :)

.gitignore Outdated
private.key
*.key
Copy link
Contributor

Choose a reason for hiding this comment

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

no big deal, but *.key and private.key overlap :)

)

response = client.update_call(UUID, action="earmuff")
pprint(response)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice use of pprint!

def recordings():
data = request.get_json()
pprint(data)
return ("200")
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel this is confusing, for a few reasons:

  • The parentheses aren't needed, and imply a tuple (which it isn't because it would need a trailing comma)
  • The string "200" will be converted to the body of the response, but it looks like the HTTP status code.
  • The HTTP 200 status code is implicit :)

I'm not sure what content would actually be useful, given that it's ignored by Nexmo's servers, but something more informative like the following may be more clear:

return "Webhook received"

def recordings():
data = request.get_json()
pprint(data)
return ("200")
Copy link
Contributor

Choose a reason for hiding this comment

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

See above


NOW = datetime.utcnow()
DATE_END = NOW.replace(microsecond=0).isoformat()+"Z"
DATE_START = (NOW - timedelta(hours=24, minutes=00)).replace(microsecond=0).isoformat()+"Z"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

DATE_START = (NOW - timedelta(hours=24, minutes=00)).replace(microsecond=0).isoformat()+"Z"

params = {"date_start": DATE_START, "date_end": DATE_END}
response = client.get_calls(params)
Copy link
Contributor

Choose a reason for hiding this comment

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

These two lines could just be:

response = client.get_calls(date_start=DATE_START, date_end=DATE_END)

... which would be more consistent with the calling conventions above - but ultimately I'm not bothered too much.

@judy2k judy2k merged commit 8afa613 into master May 24, 2018
@judy2k judy2k deleted the tony-contribs branch May 24, 2018 10:35
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.

3 participants