Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SendingHandler(urllib2.HTTPHandler):
- def http_response(self, req, response):
- return response
- ...
- ...
- # send
- msg = urllib.quote_plus(msg_body.encode('utf-8'))
- url = "http://%s?secret=%s&action=sendSms&cid=%s&to=%s&msg=%s&handler=%s&arg1=%s&arg2=%s" % (config.apiServer, config.apiSecret, cid, to, msg, handler, arg1, arg2)
- # ready to send
- logstr = "OK, We're ready to send."
- logAppend(logstr)
- # threading
- handler = urllib2.build_opener(SendingHandler())
- thread = threading.Thread(target=handler.open, args=(url,))
- # start
- logstr = "Starting thread..."
- logAppend(logstr)
- thread.start()
- thread.join()
- logstr = "Success"
- logAppend(logstr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement