We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71b25f0 commit 58a51acCopy full SHA for 58a51ac
internet/sms-free.py
@@ -24,7 +24,8 @@
24
import sys
25
26
if len(sys.argv) <= 3:
27
- print("Need more arguments: <user> <API key> <Message (in quotes)>")
+ print('Need more arguments: <user> <API key> <Message (in quotes)>')
28
+ print('ex: sms-free 01234567 aBcDE012345fgH "Hello world!"')
29
sys.exit(1)
30
31
user = sys.argv[1]
@@ -36,6 +37,7 @@
36
37
38
FULL_URL = URL + urllib.parse.urlencode(payload)
39
-response = urllib.request.urlopen(FULL_URL)
40
-code = response.getcode()
41
-print('Return code:', code)
+req = urllib.request.Request(FULL_URL)
+with urllib.request.urlopen(req) as response:
42
+ print('Return code:', response.getcode())
43
+
0 commit comments