Skip to content

Commit e317503

Browse files
committed
Fix code-inspector violation
Fix code-inspector violation Signed-off-by: Bensuperpc <[email protected]>
1 parent 69bd0b7 commit e317503

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

internet/sms-free.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env python
22
#//////////////////////////////////////////////////////////////
33
#// ____ //
44
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
@@ -13,7 +13,7 @@
1313
#// Modified: 30, July, 2021 //
1414
#// file: - //
1515
#// - //
16-
#// Source: https://mobile.free.fr/account/mes-options/notifications-sms //
16+
#// Source: https://mobile.free.fr/account/mes-options/notifications-sms //
1717
#// OS: ALL //
1818
#// CPU: ALL //
1919
#// //
@@ -25,21 +25,25 @@
2525

2626
if len(sys.argv) <= 3:
2727
print("Need more arguments: <user> <API key> <Message (in quotes)>")
28-
exit(1)
28+
sys.exit(1)
2929

3030
user = sys.argv[1]
3131
key = sys.argv[2]
3232
msg = sys.argv[3]
3333

3434
payload = { 'user' : user, 'pass' : key, 'msg' : msg}
35-
url = "https://smsapi.free-mobile.fr/sendmsg?"
35+
URL = "https://smsapi.free-mobile.fr/sendmsg?"
3636

37-
full_url = url + urllib.parse.urlencode(payload)
37+
FULL_URL = URL + urllib.parse.urlencode(payload)
3838

3939
try:
40-
response = urllib.request.urlopen(full_url)
40+
if URL.lower().startswith('https'):
41+
req = urllib.request.Request(URL)
42+
else:
43+
raise ValueError from None
44+
response = urllib.request.urlopen(FULL_URL)
4145
code = response.getcode()
4246
print('Return code:', code)
4347

44-
except Exception as e:
45-
print(f'Error: {full_url} : {str(e)}')
48+
except Exception as error:
49+
print(f'Error: {FULL_URL} : {str(error)}')

0 commit comments

Comments
 (0)