getIP endpoint now reachable
This commit is contained in:
parent
f605b65b6c
commit
297a67f57e
63
.gitignore
vendored
63
.gitignore
vendored
@ -3,58 +3,35 @@ __pycache__/
|
|||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
# C extensions
|
# Installer logs
|
||||||
*.so
|
pip-log.txt
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
.Python
|
dist
|
||||||
build/
|
build
|
||||||
develop-eggs/
|
eggs
|
||||||
dist/
|
parts
|
||||||
downloads/
|
bin
|
||||||
eggs/
|
develop-eggs
|
||||||
.eggs/
|
|
||||||
lib/
|
|
||||||
lib64/
|
|
||||||
parts/
|
|
||||||
sdist/
|
|
||||||
var/
|
|
||||||
wheels/
|
|
||||||
pip-wheel-metadata/
|
|
||||||
share/python-wheels/
|
|
||||||
*.egg-info/
|
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
scratch
|
||||||
MANIFEST
|
env
|
||||||
|
venv*
|
||||||
|
wheels
|
||||||
|
|
||||||
# Unit test / coverage reports
|
# Unit test / coverage reports
|
||||||
htmlcov/
|
|
||||||
.tox/
|
|
||||||
.nox/
|
|
||||||
.coverage
|
.coverage
|
||||||
.coverage.*
|
|
||||||
.cache
|
|
||||||
nosetests.xml
|
|
||||||
coverage.xml
|
|
||||||
*.cover
|
|
||||||
.hypothesis/
|
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
|
.tox
|
||||||
|
test.py
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
#htmlcov
|
||||||
|
htmlcov*
|
||||||
|
|
||||||
# pyenv
|
# pyenv
|
||||||
.python-version
|
.python-version
|
||||||
|
|
||||||
# Environments
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
|
|
||||||
# Visual Studio Code
|
# Visual Studio Code
|
||||||
.vscode/*
|
.vscode/
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
@ -1,6 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import json
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from voipms.base.exceptions import VoipException
|
from voipms.base.exceptions import VoipException
|
||||||
|
|
||||||
class Client(object):
|
class Client(object):
|
||||||
@ -30,8 +32,14 @@ class Client(object):
|
|||||||
params["method"] = method
|
params["method"] = method
|
||||||
params["content_type"] = "json"
|
params["content_type"] = "json"
|
||||||
|
|
||||||
response = requests.get(self.api_base, params=params).json()
|
response = requests.get(self.api_base, params=params)
|
||||||
return response
|
data = json.loads(response.text)
|
||||||
|
|
||||||
|
if data['status'] and data['status'] != 'success':
|
||||||
|
err = data['status']
|
||||||
|
raise VoipException("API Call failed with exception: {}".format(err))
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def accounts(self):
|
def accounts(self):
|
||||||
@ -44,30 +52,34 @@ class Client(object):
|
|||||||
def call_detail_records(self):
|
def call_detail_records(self):
|
||||||
if self._call_detail_records is None:
|
if self._call_detail_records is None:
|
||||||
from voipms.api.call_detail_records import CallDetailRecords
|
from voipms.api.call_detail_records import CallDetailRecords
|
||||||
self._call_detail_records = CallDetailRecords()
|
self._call_detail_records = CallDetailRecords(self)
|
||||||
return self._call_detail_records
|
return self._call_detail_records
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dids(self):
|
def dids(self):
|
||||||
if self._dids is None:
|
if self._dids is None:
|
||||||
from voipms.api.dids import DIDs
|
from voipms.api.dids import DIDs
|
||||||
self._dids = DIDs()
|
self._dids = DIDs(self)
|
||||||
return self._dids
|
return self._dids
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def general(self):
|
def general(self):
|
||||||
if self._general is None:
|
if self._general is None:
|
||||||
from voipms.api.general import General
|
from voipms.api.general import General
|
||||||
self._general = General()
|
self._general = General(self)
|
||||||
return self._general
|
return self._general
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def voicemail(self):
|
def voicemail(self):
|
||||||
if self._voicemail is None:
|
if self._voicemail is None:
|
||||||
from voipms.api.voicemail import Voicemail
|
from voipms.api.voicemail import Voicemail
|
||||||
self._voicemail = Voicemail()
|
self._voicemail = Voicemail(self)
|
||||||
return self._voicemail
|
return self._voicemail
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def balance(self):
|
def balance(self):
|
||||||
return self.accounts.balance
|
return self.general.balance
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ip(self):
|
||||||
|
return self.general.ip
|
@ -1,12 +1,4 @@
|
|||||||
from voipms.api.accounts.balance import Balance
|
|
||||||
|
|
||||||
class Accounts():
|
class Accounts():
|
||||||
def __init__(self, base):
|
def __init__(self, base):
|
||||||
self._balance = None
|
self._balance = None
|
||||||
self.base = base
|
self.base = base
|
||||||
|
|
||||||
@property
|
|
||||||
def balance(self):
|
|
||||||
if self._balance is None:
|
|
||||||
self._balance = Balance(self.base)
|
|
||||||
return self._balance
|
|
@ -1,3 +1,4 @@
|
|||||||
class CallDetailRecords():
|
class CallDetailRecords():
|
||||||
def __init__(self):
|
def __init__(self, base):
|
||||||
pass
|
self._balance = None
|
||||||
|
self.base = base
|
@ -1,3 +1,4 @@
|
|||||||
class DIDs():
|
class DIDs():
|
||||||
def __init__(self):
|
def __init__(self, base):
|
||||||
pass
|
self._balance = None
|
||||||
|
self.base = base
|
@ -1,3 +1,21 @@
|
|||||||
|
from voipms.api.general.balance import Balance
|
||||||
|
from voipms.api.general.ip import IP
|
||||||
|
|
||||||
class General():
|
class General():
|
||||||
def __init__(self):
|
def __init__(self, base):
|
||||||
pass
|
self._balance = None
|
||||||
|
self._ip = None
|
||||||
|
|
||||||
|
self.base = base
|
||||||
|
|
||||||
|
@property
|
||||||
|
def balance(self):
|
||||||
|
if self._balance is None:
|
||||||
|
self._balance = Balance(self.base)
|
||||||
|
return self._balance
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ip(self):
|
||||||
|
if self._ip is None:
|
||||||
|
self._ip = IP(self.base)
|
||||||
|
return self._ip
|
7
voipms/api/general/ip.py
Normal file
7
voipms/api/general/ip.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class IP():
|
||||||
|
def __init__(self, base):
|
||||||
|
self.method = "getIP"
|
||||||
|
self.base = base
|
||||||
|
|
||||||
|
def fetch(self, params={}):
|
||||||
|
return self.base.request(self.method)
|
@ -1,3 +1,4 @@
|
|||||||
class Voicemail():
|
class Voicemail():
|
||||||
def __init__(self):
|
def __init__(self, base):
|
||||||
self._balance = None
|
self._balance = None
|
||||||
|
self.base = base
|
Loading…
Reference in New Issue
Block a user