本文整理汇总了Python中sender.Sender类的典型用法代码示例。如果您正苦于以下问题:Python Sender类的具体用法?Python Sender怎么用?Python Sender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sender类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, config, log):
Sender.__init__(self, config, log)
self.access_key = config.get('Messenger', 'gcm_access_key')
self.base_deeplink_url = config.get('Messenger', 'base_deeplink_url')
self.gcm = GCM(self.access_key)
self.canonical_ids = []
self.unregistered_devices = []
开发者ID:bytearchive,项目名称:pushkin,代码行数:7,代码来源:gcm_push_sender.py
示例2: main
def main():
# TODO: parse configuration file to retreive
# sender's and receiver's ip addresses
config_dict = parse_config()
if not config_dict:
print 'no config params'
return
sender_name = config_dict['IP'] + '_sender'
recv_name = config_dict['IP'] + '_receiver'
print 'sender name: ' + sender_name
print 'receiver name: ' + recv_name
s_obj = Sender()
r_obj = Receiver()
s_obj.ip_address = config_dict['IP']
r_obj.ip_address = config_dict['IP']
s_obj.multicast_address = config_dict['multicast']
r_obj.multicast_address = config_dict['multicast']
Pyro4.Daemon.serveSimple(
{
s_obj: sender_name,
r_obj: recv_name
},
ns=False,
port=45000,
host=config_dict["IP"]
)
开发者ID:HMazen,项目名称:pcd,代码行数:26,代码来源:managed-daemon.py
示例3: OnActionStart
def OnActionStart(self, event):
handler = rt.RichTextHTMLHandler()
handler.SetFlags(rt.RICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64)
handler.SetFontSizeMapping([7,9,11,12,14,22,100])
import cStringIO
stream = cStringIO.StringIO()
if not handler.SaveStream(self.richTextPanel.rtc.GetBuffer(), stream):
return
htmldata = stream.getvalue()
text = content.mime_message(htmldata, "hello hello this is a test", "this is a test", "[email protected]",
"[email protected]").as_string()
with open('email-example.eml', 'w') as f:
f.write(text)
#start send
listctrl = self.list_ctrl
_count = listctrl.GetItemCount()
_host = config.read_config(config.HOST)
_port = config.read_config(config.PORT)
_user = config.read_config(config.ACCOUNT_NAME)
_password = config.read_config(config.PASSWORD)
_from = config.read_config(config.FROM)
sender = Sender(_host, _port)
sender.login(_user, _password)
for i in range(_count):
sender.send(_from, listctrl.GetItem(i, 1).GetText(), text)
开发者ID:patrickwai,项目名称:PyMail,代码行数:28,代码来源:main.py
示例4: postIpDel
def postIpDel(request):
form = IpForm(request.REQUEST, request.FILES)
if not form.is_valid():
return json_response({"status": FORM_ERR, "result": 'Ошибка формы'})
login = form.cleaned_data['user_login']
del_ips = json.loads(form.cleaned_data['ip_list'])
kwargs = {'action': 'del_ip', 'user': login, 'ip_list': '{ip_list:' + json.dumps(del_ips) + '}'}
from models import WebApiSetting
web_api_settings = WebApiSetting.objects.all();
if len(web_api_settings)>0:
sd = Sender(web_api_settings[0].host,web_api_settings[0].port, web_api_settings[0].users_url)
status, reason, resp = sd.sendData(kwargs)
if status == ERROR400:
return json_response({"status":LOGIN_ERR, "result": "Неверное указано имя пользователя"})
elif status != SUCCESS:
logging.error("videoclient.configuration.web_api_users.wiews.postIpDel(connection failed) :" + 'Ошибка соединения при получении списка ip адресов пользователя')
return json_response({"status":ERROR, "result": "Повторите запрос позже"})
else:
logging.error("videoclient.configuration.web_api_users.wiews.postIpDel(connection failed) :" + 'Отсутствуют настройки для WEB API')
return json_response({"status":ERROR, "result": "Повторите запрос позже"})
return json_response({"status": OK, "result": "IP-адреса удалены (" + str(len(del_ips)) + ')'})
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:26,代码来源:views.py
示例5: postTableStatistics
def postTableStatistics(request):
form = StatisticForm(request.REQUEST, request.FILES)
if not form.is_valid():
return json_response({"status": FORM_ERR, "result": 'Повторите запрос позже'})
data = dict()
login = form.cleaned_data['user_login']
s_date = form.cleaned_data['start_date']
e_date = form.cleaned_data['end_date']
query = form.cleaned_data['query']
sorto = form.cleaned_data["sorto"]
data['sorto'] = sorto
data['up'] = form.cleaned_data['up']
kwargs = {'user': login, 'query': query, 'start_date': s_date, 'end_date': e_date}
from models import WebApiSetting
web_api_settings = WebApiSetting.objects.all();
if len(web_api_settings)==0:
logging.error("videoclient.configuration.web_api_users.wiews.postIpDel(connection failed) :" + 'Отсутствуют настройки для WEB API')
return json_response({"status": ERROR, "result": 'Стастистика временно недоступна. Повторите запрос позже.'})
sd = Sender(web_api_settings[0].host,web_api_settings[0].port, web_api_settings[0].stat_url)
status, reason, resp = sd.sendData(kwargs)
del sd
if status == ERROR400:
return json_response({"status": LOGIN_ERR, "result": 'Неизвестный пользователь'})
if status != SUCCESS:
return json_response({"status": ERROR, "result": 'Стастистика временно недоступна. Повторите запрос позже.'})
ipstat = json.loads(resp)
#вычисляем суммы столбцов и строк таблицы
total = {}
column_list = ['detect', 'detect_and_identification', 'fanstudio']
for column_name in column_list:
total[column_name] = 0
total['total'] = 0
for host in ipstat:
host['total'] = 0
for column_name in column_list:
total[column_name] += host[column_name]
total['total'] += host[column_name]
host['total'] += host[column_name]
#сортируем
sort_fields = ["ip", 'detect', 'detect_and_identification', 'fanstudio', 'total']
if sorto > 0 and sorto <= len(sort_fields):
sort = [[sort_fields[sorto - 1]]]
ipstat = GlobalSortUser(ipstat, sort, 1, up=form.cleaned_data["up"])
data['table'] = ipstat
data['total'] = total
from django.template import loader
if ipstat:
result = loader.render_to_string('stat_table.html', data)
else:
result = False
return json_response({'result': result, 'status': OK})
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:59,代码来源:views.py
示例6: __init__
def __init__(self, config, log):
Sender.__init__(self, config, log)
self.sandbox = config.getboolean('Messenger', 'apns_sandbox')
self.certificate_path = config.get('Messenger', 'apns_certificate_path')
self.topic = config.get('Messenger', 'apns_topic')
self.apn = APNsClient(self.certificate_path, use_sandbox=self.sandbox, log=log)
self.canonical_ids = []
self.unregistered_devices = []
开发者ID:Nordeus,项目名称:pushkin,代码行数:8,代码来源:apns2_push_sender.py
示例7: submit
def submit(d):
header = Header(d["method"], d["path"], d["httpversion"])
for i in d['headers']:
header.add_header(i['header_name'], i['header_value'])
header.build_from_text()
print(header.payload)
s = Sender()
r = Response()
resp = r.input_text(s.send(d["protocol"], d["hostname"], header.payload))
return resp
开发者ID:gorillanet,项目名称:httpTester,代码行数:10,代码来源:main.py
示例8: stream_sdata
def stream_sdata(self, datasize, cl_port):
if self.state != 2:
logging.error('stream_sdata: unexpected cur_state=%s', self.state)
return
#
to_addr = (self.cl_ip, cl_port)
sender = Sender(dst_addr = to_addr,
proto = self.proto,
datasize = datasize,
tx_type = self.tx_type,
file_url = self.file_url )
sender.init_send()
开发者ID:mfatihaktas,项目名称:sim_rel,代码行数:12,代码来源:producer.py
示例9: main
def main():
users = Users()
receiver = Receiver()
sender = Sender()
while True:
receiver.read_emails(users)
for user in users.users_map.values():
if user.modified:
sender.send_news(user.email, list(user.topics_set))
user.modified = False
print ('Sleeping')
sleep(10)
print ('Waking up')
开发者ID:ankurchauhan21,项目名称:CodeForCubaHackathon,代码行数:13,代码来源:main.py
示例10: __send_broadcast_frame
def __send_broadcast_frame(self, frame):
"""
Method that send broadcast frame if possible or push the frame to the queue of all Workers.
This is necessary because we are not able to identify ACK frames because of the missing sequence number on WiWo
frames.
"""
if self.__are_workers_available_for_broadcast_frame():
self.__set_workers_to_wait_response(frame)
Sender.send(frame, self.__iface_name)
else:
time.sleep(1) # TODO: Fix this code, it's not clear.
if self.__are_workers_available_for_broadcast_frame():
self.__set_workers_to_wait_response(frame)
Sender.send(frame, self.__iface_name)
开发者ID:azizjonm,项目名称:wiwo,代码行数:14,代码来源:manager_svc.py
示例11: getTableIp
def getTableIp(request):
form = UserForm(request.REQUEST, request.FILES)
data = dict()
ips = []
if form.is_valid():
login = form.cleaned_data["user_login"]
sorto = form.cleaned_data["sorto"]
up = form.cleaned_data["up"]
data.update(form.cleaned_data)
kwargs = {'action': 'get_ip', 'user': login}
from models import WebApiSetting
web_api_settings = WebApiSetting.objects.all();
if len(web_api_settings)>0:
sd = Sender(web_api_settings[0].host,web_api_settings[0].port, web_api_settings[0].users_url)
status, reason, resp_str = sd.sendData(kwargs)
if status == ERROR400:
data["error"] = LOGIN_ERR
elif status != SUCCESS:
data["error"] = ERROR
else:
resp = json.loads(resp_str)
if 'ip_list' in resp:
ips = resp['ip_list']
else:
logging.error("videoclient.configuration.web_api_users.wiews.getTableIp(connection failed) :" + 'Отсутствуют настройки для WEB API')
data["error"] = ERROR
else:
data["user_login"] = ''
data["error"] = FORM_ERR
if 'error' in data:
return json_response({'status': data["error"], 'result': ''})
#сортируем
sort_fields = ["ip"]
sorto = form.cleaned_data["sorto"]
if sorto > 0 and sorto <= len(sort_fields):
ips = sorted(ips, reverse=(up == 0))
data["ip_list"] = ips
from django.template import loader
result = loader.render_to_string('ip_table.html', data, context_instance=RequestContext(request))
return json_response({'status': OK, 'result': result})
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:50,代码来源:views.py
示例12: main
def main():
sender = Sender('localhost')
sender.connect()
sender.create_queue('inbox')
sender.send_message('inbox', 'hello')
sender.disconnect()
receiver = Receiver('localhost')
receiver.connect()
receiver.receive('inbox')
receiver.disconnect()
开发者ID:AzharWeb,项目名称:sandbox,代码行数:11,代码来源:program.py
示例13: sender_query
def sender_query(self, mac=None, sort='last_seen', time_window=None, advanced=None, count=None):
"""Query the database for a sender by it's MAC address.
If mac is None - return a list of all senders.
sort can start with `-' to change sort direction
time_window - recently seen (X seconds) senders only
"""
# Parse sorting order
direction = 1
if sort.startswith('-'):
direction = -1
sort = sort[1:]
# Build query
where = {}
if mac is not None:
where['mac'] = mac.lower()
if time_window:
now = time()
where['aggregate.last_seen'] = {
'$gt': now - time_window
}
if advanced is not None:
where.update(advanced)
senders = self.knowledge.find(where).sort(sort, direction)
if count is not None:
senders = senders[:count]
return Sender.create_from_db(senders)
开发者ID:FomkaV,项目名称:wifi-arsenal,代码行数:33,代码来源:knowledge.py
示例14: _send
def _send(self, frame, iface_name):
self.__communication_status = Worker.COMMUNICATION_WAITING
self.__last_frame_sent = frame
frame = Sender.send(frame, iface_name)
log_line = "- [SENT]: %s" % repr(frame)
self.__frame_log.append(log_line)
return frame
开发者ID:azizjonm,项目名称:wiwo,代码行数:7,代码来源:worker.py
示例15: __init__
def __init__(self, config, log):
"""
APNs Push Sender uses MODIFIED (watch out if you want to update it) PyAPNs module: https://github.com/djacobs/PyAPNs
APNs documentation: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW4
"""
Sender.__init__(self, config, log)
self.sent_queue = {}
self.batch_size = int(config.get('Messenger', 'apns_batch_size'))
self.sandbox = config.get('Messenger', 'apns_sandbox') == 'true'
self.certificate_path = config.get('Messenger', 'apns_certificate_path')
set_logger(log)
self.apns = APNs(use_sandbox=self.sandbox, cert_file=self.certificate_path, enhanced=True,
write_retries=self.connection_error_retries)
self.apns.gateway_server.register_response_listener(self.process_malformed_notification)
self.apns.gateway_server.register_error_listener(self.process_failed_notification)
开发者ID:srdjan-bozovic,项目名称:pushkin,代码行数:17,代码来源:apns_push_sender.py
示例16: main
def main():
global indexer, uploader, sender, receiver, downloader
setup_signals()
logging.info("Asink client started at %s" %
(time.strftime("%a, %d %b %Y %X GMT", time.gmtime())))
#create all threads which will be used to process events
indexer = Indexer()
uploader = Uploader()
sender = Sender()
receiver = Receiver()
downloader = Downloader()
#create and set up queues which are used to pass events between threads
uploader_queue = Queue()
indexer.uploader_queue = uploader_queue
uploader.queue = uploader_queue
#set on watcher when initialized
sender_queue = Queue()
uploader.sender_queue = sender_queue
sender.queue = sender_queue
downloader_queue = Queue()
receiver.downloader_queue = downloader_queue
downloader.queue = downloader_queue
#setup storage provider
storage = setup_storage()
uploader.storage = storage.clone()
downloader.storage = storage
#start all threads
watcher.start_watching(uploader_queue)
indexer.start()
uploader.start()
sender.start()
receiver.start()
downloader.start()
#sleep until signaled, which will call sig_handler
while True:
time.sleep(86400) #= 24 hours just for fun
开发者ID:OmniPi,项目名称:asink,代码行数:43,代码来源:client.py
示例17: __init__
def __init__(self, packet_sender):
print 'Init Connection'
self.ee = EventEmitter()
self._sender = Sender(packet_sender)
self._receiver = Receiver(packet_sender)
@self._receiver.ee.on('data')
def on_data(data):
self.ee.emit('data', data)
开发者ID:hoffmabc,项目名称:python-rudp,代码行数:11,代码来源:connection.py
示例18: send
def send(self, url):
for output in self.output.keys():
classes = Sender.__subclasses__()
for cls in classes:
if cls.is_registrar_for(output):
params = self.output.get(output)
params['subject'] = self.subject
params['status'] = self.status
params['dryrun'] = self.dryrun
params['verbose'] = self.verbose
sender = cls(**params)
sender.send(url)
开发者ID:mpspradlin,项目名称:analytics-asana-stats,代码行数:12,代码来源:report.py
示例19: __init__
def __init__(self, tsid, ssid):
Sender.__init__(self, tsid, ssid)
self.mid = ""
self.timer = Timer()
self.uid2player = {}
self.presenter = None
self.cache_billboard = {}
self.cc = CacheCenter(tsid, ssid)
self.mode = Question
self.idle_state = IdleState(self)
self.ready_state = ReadyState(self)
self.timing_state = TimingState(self)
self.timeup_state = TimeupState(self)
self.statistics_state = StatisticsState(self)
self.answer_state = AnswerState(self)
self.announce_state = AnnounceState(self)
self.award_state = AwardState(self)
self.ending_state = EndingState(self)
self.state = self.idle_state
self.SetState(self.idle_state)
self.loopGetBillboard()
开发者ID:lsaint,项目名称:millionaire,代码行数:23,代码来源:room.py
示例20: postDataStatistics
def postDataStatistics(request):
form = StatisticForm(request.REQUEST, request.FILES)
data = dict()
if not form.is_valid():
return json_response({"status": FORM_ERR, "result": 'Повторите запрос позже'})
login = form.cleaned_data["user_login"]
s_date = form.cleaned_data['start_date']
e_date = form.cleaned_data['end_date']
query = form.cleaned_data['query']
data["user_login"] = login
kwargs = {'user': login, 'query': query, 'start_date': s_date, 'end_date': e_date}
from models import WebApiSetting
web_api_settings = WebApiSetting.objects.all();
if len(web_api_settings)==0:
logging.error("videoclient.configuration.web_api_users.wiews.postDataStatistics(connection failed) :" + 'Отсутствуют настройки для WEB API')
return json_response({"status": ERROR, "result": 'Стастистика временно недоступна. Повторите запрос позже.'})
sd = Sender(web_api_settings[0].host,web_api_settings[0].port, web_api_settings[0].stat_url)
status, reason, resp = sd.sendData(kwargs)
del sd
if status == ERROR400:
return json_response({"status": LOGIN_ERR, "result": 'Неизвестный пользователь'})
if status != SUCCESS:
return json_response({"status": ERROR, "result": 'Стастистика временно недоступна. Повторите запрос позже.'})
stat = json.loads(resp)
#если данных для отображения на графике нет, то выводим сообщение
if not filter(lambda x: len(filter(lambda x:x[1] > 0, x['data'])) > 0, stat):
return json_response({"status": NO_DATA, "result": 'Отсутствуют данные за указанный период'})
e = {}
e['resp'] = resp
return json_response({'result': e, 'status': OK})
开发者ID:denis-pinaev,项目名称:tmp_trash,代码行数:36,代码来源:views.py
注:本文中的sender.Sender类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论