-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
423 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,48 @@ | ||
from .errors import CallbackRequiredError | ||
|
||
|
||
class NumberInsight: | ||
auth_type = 'params' | ||
|
||
def __init__(self, client): | ||
self._client = client | ||
|
||
def get_basic_number_insight(self, params=None, **kwargs): | ||
return self._client.get(self._client.api_host(), "/ni/basic/json", params or kwargs, auth_type=NumberInsight.auth_type) | ||
return self._client.get( | ||
self._client.api_host(), | ||
"/ni/basic/json", | ||
params or kwargs, | ||
auth_type=NumberInsight.auth_type, | ||
) | ||
|
||
def get_standard_number_insight(self, params=None, **kwargs): | ||
return self._client.get(self._client.api_host(), "/ni/standard/json", params or kwargs, auth_type=NumberInsight.auth_type) | ||
return self._client.get( | ||
self._client.api_host(), | ||
"/ni/standard/json", | ||
params or kwargs, | ||
auth_type=NumberInsight.auth_type, | ||
) | ||
|
||
def get_advanced_number_insight(self, params=None, **kwargs): | ||
return self._client.get(self._client.api_host(), "/ni/advanced/json", params or kwargs, auth_type=NumberInsight.auth_type) | ||
return self._client.get( | ||
self._client.api_host(), | ||
"/ni/advanced/json", | ||
params or kwargs, | ||
auth_type=NumberInsight.auth_type, | ||
) | ||
|
||
def get_async_advanced_number_insight(self, params=None, **kwargs): | ||
argoparams = params or kwargs | ||
if "callback" in argoparams and type(argoparams["callback"]) == str and argoparams["callback"] != "": | ||
if ( | ||
"callback" in argoparams | ||
and type(argoparams["callback"]) == str | ||
and argoparams["callback"] != "" | ||
): | ||
return self._client.get( | ||
self._client.api_host(), "/ni/advanced/async/json", params or kwargs, auth_type=NumberInsight.auth_type | ||
self._client.api_host(), | ||
"/ni/advanced/async/json", | ||
params or kwargs, | ||
auth_type=NumberInsight.auth_type, | ||
) | ||
else: | ||
raise CallbackRequiredError( | ||
"A callback is needed for async advanced number insight" | ||
) | ||
|
||
raise CallbackRequiredError("A callback is needed for async advanced number insight") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
class Ussd: | ||
defaults = {'auth_type': 'params', 'body_is_json': False} | ||
|
||
def __init__(self, client): | ||
self._client = client | ||
|
||
def send_ussd_push_message(self, params=None, **kwargs): | ||
return self._client.post(self._client.host(), "/ussd/json", params or kwargs, **Ussd.defaults) | ||
return self._client.post( | ||
self._client.host(), "/ussd/json", params or kwargs, **Ussd.defaults | ||
) | ||
|
||
def send_ussd_prompt_message(self, params=None, **kwargs): | ||
return self._client.post(self._client.host(), "/ussd-prompt/json", params or kwargs, **Ussd.defaults) | ||
return self._client.post( | ||
self._client.host(), "/ussd-prompt/json", params or kwargs, **Ussd.defaults | ||
) |
Oops, something went wrong.