-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from greensms-ru/first-draft
flake8 Lint Fixes
- Loading branch information
Showing
37 changed files
with
757 additions
and
700 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
from default import client | ||
|
||
|
||
def account_balance(): | ||
res = client.account.balance() | ||
print(res) | ||
res = client.account.balance() | ||
print(res) | ||
|
||
|
||
def account_token(): | ||
res = client.account.token(expire=100) | ||
print(res) | ||
res = client.account.token(expire=100) | ||
print(res) | ||
|
||
|
||
def account_tariff(): | ||
res = client.account.tariff() | ||
print(res) | ||
res = client.account.tariff() | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
account_balance() | ||
account_balance() | ||
|
||
account_token() | ||
account_token() | ||
|
||
account_tariff() | ||
account_tariff() |
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,14 +1,17 @@ | ||
from default import client | ||
|
||
|
||
def call_send(): | ||
res = client.call.send(to='919987409698') | ||
print(res) | ||
res = client.call.send(to='919987409698') | ||
print(res) | ||
|
||
|
||
def call_status(): | ||
res = client.call.status(id='1fd4ac4d-6e4f-4e32-b6e4-8087d3466f55') | ||
print(res) | ||
res = client.call.status(id='1fd4ac4d-6e4f-4e32-b6e4-8087d3466f55') | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
call_send() | ||
call_send() | ||
|
||
call_status() | ||
call_status() |
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,8 +1,10 @@ | ||
from default import client | ||
|
||
|
||
def status(): | ||
res = client.status() | ||
print(res) | ||
res = client.status() | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
status() | ||
status() |
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,14 +1,17 @@ | ||
from default import client | ||
|
||
|
||
def hlr_send(): | ||
res = client.hlr.send(to='919987409698', txt='1920') | ||
print(res) | ||
res = client.hlr.send(to='919987409698', txt='1920') | ||
print(res) | ||
|
||
|
||
def hlr_status(): | ||
res = client.hlr.status(id='70d296f5-ac52-403d-a27b-24829c2faebc') | ||
print(res) | ||
res = client.hlr.status(id='70d296f5-ac52-403d-a27b-24829c2faebc') | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
hlr_send() | ||
hlr_send() | ||
|
||
hlr_status() | ||
hlr_status() |
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,14 +1,17 @@ | ||
from default import client | ||
|
||
|
||
def pay_send(): | ||
res = client.pay.send(to='919987409698', amount= 10) | ||
print(res) | ||
res = client.pay.send(to='919987409698', amount=10) | ||
print(res) | ||
|
||
|
||
def pay_status(): | ||
res = client.pay.status(id='60f231d9-16ec-4313-842e-6e6853063482') | ||
print(res) | ||
res = client.pay.status(id='60f231d9-16ec-4313-842e-6e6853063482') | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
pay_send() | ||
pay_send() | ||
|
||
pay_status() | ||
pay_status() |
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,14 +1,18 @@ | ||
from default import client | ||
|
||
|
||
def sms_send(): | ||
res = client.sms.send(to='919987409698', txt='Here is your message for delivery') | ||
print(res) | ||
res = client.sms.send( | ||
to='919987409698', txt='Here is your message for delivery') | ||
print(res) | ||
|
||
|
||
def sms_status(): | ||
res = client.sms.status(id='dc2bac6d-f375-4e19-9a02-ef0148991635') | ||
print(res) | ||
res = client.sms.status(id='dc2bac6d-f375-4e19-9a02-ef0148991635') | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
sms_send() | ||
sms_send() | ||
|
||
sms_status() | ||
sms_status() |
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,6 +1,6 @@ | ||
import os | ||
from greensms.client import GreenSMS | ||
|
||
os.environ['GREENSMS_TOKEN'] = '1234' # Change this value to your actual Token | ||
os.environ['GREENSMS_TOKEN'] = '1234' # Change this value to your actual Token | ||
token_client = GreenSMS() | ||
res = token_client.account.balance() | ||
res = token_client.account.balance() |
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,14 +1,17 @@ | ||
from default import client | ||
|
||
|
||
def viber_send(): | ||
res = client.viber.send(to='919987409698',txt='Viber Message') | ||
print(res) | ||
res = client.viber.send(to='919987409698', txt='Viber Message') | ||
print(res) | ||
|
||
|
||
def viber_status(): | ||
res = client.viber.status(id='0b18fab4-0c5d-4a8b-8ee4-057a59596c7d') | ||
print(res) | ||
res = client.viber.status(id='0b18fab4-0c5d-4a8b-8ee4-057a59596c7d') | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
viber_send() | ||
viber_send() | ||
|
||
viber_status() | ||
viber_status() |
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,14 +1,17 @@ | ||
from default import client | ||
|
||
|
||
def voice_send(): | ||
res = client.voice.send(to='919987409698', txt='1234') | ||
print(res) | ||
res = client.voice.send(to='919987409698', txt='1234') | ||
print(res) | ||
|
||
|
||
def voice_status(): | ||
res = client.voice.status(id='41f23094-deda-4cab-ac9c-3ab4f2fee9e6') | ||
print(res) | ||
res = client.voice.status(id='41f23094-deda-4cab-ac9c-3ab4f2fee9e6') | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
voice_send() | ||
voice_send() | ||
|
||
voice_status() | ||
voice_status() |
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,8 +1,10 @@ | ||
from default import client | ||
|
||
|
||
def whois_lookup(): | ||
res = client.whois.lookup(to='4477743336335') | ||
print(res) | ||
res = client.whois.lookup(to='4477743336335') | ||
print(res) | ||
|
||
|
||
if __name__ == '__main__': | ||
whois_lookup() | ||
whois_lookup() |
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,2 +1,2 @@ | ||
def test(): | ||
return ('Test String') | ||
return ('Test String') |
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,34 +1,35 @@ | ||
from greensms.utils.validator import validate | ||
|
||
|
||
class Module: | ||
""" | ||
Module Instance Class | ||
""" | ||
Module Instance Class | ||
Call that inits with default args and has an API function to call the Rest API along with Validation | ||
""" | ||
def __init__(self, rest_client, module_schema, **kwargs): | ||
self.rest_client = rest_client | ||
self.module_schema = module_schema | ||
self.params = {} | ||
Call that inits with default args and has an API function to call the Rest API along with Validation | ||
""" | ||
|
||
for key, value in kwargs.items(): | ||
self.params[key] = value | ||
def __init__(self, rest_client, module_schema, **kwargs): | ||
self.rest_client = rest_client | ||
self.module_schema = module_schema | ||
self.params = {} | ||
|
||
def api_func(self, **kwargs): | ||
for key, value in kwargs.items(): | ||
self.params[key] = value | ||
|
||
if self.module_schema is not None: | ||
errors = validate(self.module_schema, kwargs) | ||
if errors: | ||
return errors | ||
def api_func(self, **kwargs): | ||
|
||
api_params={} | ||
for key, value in kwargs.items(): | ||
api_params[key] = value | ||
if self.module_schema is not None: | ||
errors = validate(self.module_schema, kwargs) | ||
if errors: | ||
return errors | ||
|
||
request_params = self.params.copy() | ||
request_params['params'] = api_params | ||
api_params = {} | ||
for key, value in kwargs.items(): | ||
api_params[key] = value | ||
|
||
response = self.rest_client.request(**request_params) | ||
request_params = self.params.copy() | ||
request_params['params'] = api_params | ||
|
||
return response | ||
response = self.rest_client.request(**request_params) | ||
|
||
return response |
Oops, something went wrong.