Skip to content

Commit

Permalink
patching
Browse files Browse the repository at this point in the history
  • Loading branch information
terry authored and h4n1virus committed May 31, 2020
1 parent 721f911 commit 5f52dc6
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="smspva-wrapper",
version="0.0.2",
version="0.0.3",
author="Terry",
author_email="[email protected]",
description="SMSPVA wrapper",
Expand Down
2 changes: 1 addition & 1 deletion smspva_wrapper/methods/raw_api/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .check_errors import check_errors
from .responce_hack import responce_hack
from .fix_inconsistencies import inconsistencies_hack
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def responce_hack(d: dict) -> dict:
def inconsistencies_hack(d: dict) -> dict:
"""Shitty hack to fix inconsistencies in API responses
Args:
Expand All @@ -10,4 +10,7 @@ def responce_hack(d: dict) -> dict:
if 'responce' in d:
d['response'] = d.pop('responce')

if 'Service' in d:
d['service'] = d.pop('Service')

return d
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_balance_sim.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -30,7 +30,7 @@ def raw_balance_sim(self, service: str, _id: str) -> dict:

q = f"metod=balance_sim&service={service}&id={_id}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_ban.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -31,7 +31,7 @@ def raw_ban(self, service: str, _id: str) -> dict:

q = f"metod=ban&service={service}&id={_id}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_denial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -32,7 +32,7 @@ def raw_denial(self, service: str, country: str, _id: str) -> dict:

q = f"metod=denial&service={service}&country={country}&id={_id}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_get_2fa.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -28,7 +28,7 @@ def raw_get_2fa(self, secret: str) -> dict:

q = f"metod=get_2fa&secret={secret}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_get_balance.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand All @@ -26,7 +26,7 @@ def raw_get_balance(self) -> dict:

q = f"metod=get_balance"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_get_clearsms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -31,7 +31,7 @@ def raw_get_clearsms(self, service: str, _id: str) -> dict:

q = f"metod=get_clearsms&service={service}&id={_id}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
6 changes: 2 additions & 4 deletions smspva_wrapper/methods/raw_api/raw_get_count_new.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -29,12 +29,10 @@ def raw_get_count_new(self, service: str, country: str) -> dict:

q = f"metod=get_count_new&service={service}&country={country}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
elif c.get('Service') == service:
return c
elif c.get('service') == service:
return c
else:
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_get_number.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -30,7 +30,7 @@ def raw_get_number(self, service: str, country: str) -> dict:

q = f"metod=get_number&service={service}&country={country}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_get_proverka.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -37,7 +37,7 @@ def raw_get_proverka(self, service: str, number: str) -> dict:

q = f"metod=get_proverka&service={service}&id={number}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_get_service_price.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -29,7 +29,7 @@ def raw_get_service_price(self, service: str, country: str) -> dict:

q = f"metod=get_service_price&service={service}&country={country}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_get_sms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -43,7 +43,7 @@ def raw_get_sms(self, service: str, country: str, _id: str, sms: bool = False) -
q = f"{q}&sms=sms"

r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_get_userinfo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand All @@ -26,7 +26,7 @@ def raw_get_userinfo(self) -> dict:

q = f"metod=get_userinfo"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down
4 changes: 2 additions & 2 deletions smspva_wrapper/methods/raw_api/raw_redirect.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from smspva_wrapper.caller import Caller
from .helpers import responce_hack, check_errors
from .helpers import inconsistencies_hack, check_errors
from smspva_wrapper.errors import *


Expand Down Expand Up @@ -36,7 +36,7 @@ def raw_redirect(self, service: str, _id: str, number_redirect: str) -> dict:

q = f"metod=redirect&service={service}&id={_id}&number_redirect={number_redirect}"
r = self.call(q)
c = responce_hack(r)
c = inconsistencies_hack(r)

if check_errors(c) is True:
return c
Expand Down

0 comments on commit 5f52dc6

Please sign in to comment.