Skip to content

Commit 23dc74b

Browse files
authored
Force HTTPS (#17)
From december 1st 2022, the API endpoints won't be usable anymore using HTTP. The host property now only have to be set with the endpoint, for example api.smsbox.pro instead of https://api.smsbox.pro Signed-off-by: Patrick ZAJDA <[email protected]>
1 parent f01b3d2 commit 23dc74b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The `pysmsboxnet.net.api.Client` has the following methods:
1313

1414
- Constructor which takes the following arguments:
1515
- session: an instance of aiohttp.ClientSession
16-
- host (str): the SMSBox API endpoint I.E. `https://api.smsbox.pro`
16+
- host (str): the SMSBox API endpoint I.E. `api.smsbox.pro` (without http(s):// because https is forced)
1717
- cleApi (str): your smsbox.net API key, [see API documentation](https://en.smsbox.net/docs/doc-API-SMSBOX-1.1-EN.html); name is in French to reflect API documentation
1818
- timeout (int, optional, default 30
1919
- Send (return int: 0 or ID of sent SMS if applicable)

example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
async def main():
1212
async with aiohttp.ClientSession() as session:
13-
sms = Client(session, "https://api.smsbox.pro", API_KEY)
13+
sms = Client(session, "api.smsbox.pro", API_KEY)
1414

1515
try:
1616
# To send a message

pysmsboxnet/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async def __smsbox_request(self, uri: str, parameters: dict) -> str:
2727

2828
try:
2929
async with self.session.post(
30-
url=f"{self.host}/{uri}",
30+
url=f"https://{self.host}/{uri}",
3131
headers=headers,
3232
data=parameters,
3333
timeout=ClientTimeout(total=self.timeout),

tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pysmsboxnet.api import Client
1010

1111
# Constents
12-
SMSBOX_HOST = "https://api.smsbox.pro"
12+
SMSBOX_HOST = "api.smsbox.pro"
1313
SMSBOX_API_KEY = "pub-xxxxx-xxxxx-xxxx-xxxx-xxxxx-xxxxxxxx"
1414
SMS_RECIPIENT = "9999001"
1515
SMS_MSG = "Test d'un message ! En plus il va être envoyé."

0 commit comments

Comments
 (0)