diff --git a/setup.py b/setup.py index 0c480a6..925142c 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="smspva-wrapper", - version="0.0.2", + version="0.0.3", author="Terry", author_email="terry@beatwo.men", description="SMSPVA wrapper", diff --git a/smspva_wrapper/methods/raw_api/helpers/__init__.py b/smspva_wrapper/methods/raw_api/helpers/__init__.py index a218038..64288cd 100644 --- a/smspva_wrapper/methods/raw_api/helpers/__init__.py +++ b/smspva_wrapper/methods/raw_api/helpers/__init__.py @@ -1,2 +1,2 @@ from .check_errors import check_errors -from .responce_hack import responce_hack +from .fix_inconsistencies import inconsistencies_hack diff --git a/smspva_wrapper/methods/raw_api/helpers/responce_hack.py b/smspva_wrapper/methods/raw_api/helpers/fix_inconsistencies.py similarity index 71% rename from smspva_wrapper/methods/raw_api/helpers/responce_hack.py rename to smspva_wrapper/methods/raw_api/helpers/fix_inconsistencies.py index 1f85dd7..f90b335 100644 --- a/smspva_wrapper/methods/raw_api/helpers/responce_hack.py +++ b/smspva_wrapper/methods/raw_api/helpers/fix_inconsistencies.py @@ -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: @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_balance_sim.py b/smspva_wrapper/methods/raw_api/raw_balance_sim.py index bf2b3df..dcae2e3 100644 --- a/smspva_wrapper/methods/raw_api/raw_balance_sim.py +++ b/smspva_wrapper/methods/raw_api/raw_balance_sim.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_ban.py b/smspva_wrapper/methods/raw_api/raw_ban.py index 074a112..e9b9645 100644 --- a/smspva_wrapper/methods/raw_api/raw_ban.py +++ b/smspva_wrapper/methods/raw_api/raw_ban.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_denial.py b/smspva_wrapper/methods/raw_api/raw_denial.py index 6361d0f..c38a2de 100644 --- a/smspva_wrapper/methods/raw_api/raw_denial.py +++ b/smspva_wrapper/methods/raw_api/raw_denial.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_get_2fa.py b/smspva_wrapper/methods/raw_api/raw_get_2fa.py index 346bb83..3e17cb5 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_2fa.py +++ b/smspva_wrapper/methods/raw_api/raw_get_2fa.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_get_balance.py b/smspva_wrapper/methods/raw_api/raw_get_balance.py index ace74ee..11b6bac 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_balance.py +++ b/smspva_wrapper/methods/raw_api/raw_get_balance.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_get_clearsms.py b/smspva_wrapper/methods/raw_api/raw_get_clearsms.py index 0c8293b..1571687 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_clearsms.py +++ b/smspva_wrapper/methods/raw_api/raw_get_clearsms.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_get_count_new.py b/smspva_wrapper/methods/raw_api/raw_get_count_new.py index ec53fe4..c7b3db2 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_count_new.py +++ b/smspva_wrapper/methods/raw_api/raw_get_count_new.py @@ -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 * @@ -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: diff --git a/smspva_wrapper/methods/raw_api/raw_get_number.py b/smspva_wrapper/methods/raw_api/raw_get_number.py index e47b4f6..96a2a36 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_number.py +++ b/smspva_wrapper/methods/raw_api/raw_get_number.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_get_proverka.py b/smspva_wrapper/methods/raw_api/raw_get_proverka.py index b2a0a34..9bb8af4 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_proverka.py +++ b/smspva_wrapper/methods/raw_api/raw_get_proverka.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_get_service_price.py b/smspva_wrapper/methods/raw_api/raw_get_service_price.py index 1ec1c39..f745c58 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_service_price.py +++ b/smspva_wrapper/methods/raw_api/raw_get_service_price.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_get_sms.py b/smspva_wrapper/methods/raw_api/raw_get_sms.py index 4e70f16..7c67dca 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_sms.py +++ b/smspva_wrapper/methods/raw_api/raw_get_sms.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_get_userinfo.py b/smspva_wrapper/methods/raw_api/raw_get_userinfo.py index ddba577..df41d63 100644 --- a/smspva_wrapper/methods/raw_api/raw_get_userinfo.py +++ b/smspva_wrapper/methods/raw_api/raw_get_userinfo.py @@ -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 * @@ -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 diff --git a/smspva_wrapper/methods/raw_api/raw_redirect.py b/smspva_wrapper/methods/raw_api/raw_redirect.py index edffd0f..cfecca9 100644 --- a/smspva_wrapper/methods/raw_api/raw_redirect.py +++ b/smspva_wrapper/methods/raw_api/raw_redirect.py @@ -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 * @@ -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