checking scirpt with pylint
This commit is contained in:
parent
7f2ea815b6
commit
5d72fda972
|
@ -1,12 +1,12 @@
|
|||
import xmlrpclib
|
||||
import json
|
||||
import time
|
||||
"""Bitmessage AutoResponder"""
|
||||
import configparser
|
||||
import json
|
||||
import os
|
||||
|
||||
import time
|
||||
import xmlrpclib
|
||||
|
||||
class BitmessageAutoresponder():
|
||||
|
||||
"""Sending and receiving messages through autoresponder"""
|
||||
config = configparser.ConfigParser()
|
||||
db_var = os.path.join(os.environ["HOME"], '.config/PyBitmessage/credentials.ini')
|
||||
config.read(db_var)
|
||||
|
@ -19,11 +19,10 @@ class BitmessageAutoresponder():
|
|||
|
||||
def send_autorepond_inbox_message(self):
|
||||
"""Sending Auto Message To The Recipient"""
|
||||
cls = self.__class__
|
||||
track = {}
|
||||
while True:
|
||||
inboxMessages=json.loads(self.api.getAllInboxMessages())
|
||||
inbox_var=inboxMessages.get('inboxMessages')
|
||||
inboxmessages = json.loads(self.api.getAllInboxMessages())
|
||||
inbox_var = inboxmessages.get('inboxMessages')
|
||||
currenttime = time.time()
|
||||
for values in inbox_var:
|
||||
msgid = values.get('msgid')
|
||||
|
@ -38,28 +37,24 @@ class BitmessageAutoresponder():
|
|||
pass
|
||||
if toaddress == fromaddress:
|
||||
continue
|
||||
ackData=self.api.sendMessage(toaddress,fromaddress,subject,message)
|
||||
self.api.sendMessage(toaddress, fromaddress, subject, message)
|
||||
self.api.trashMessage(msgid)
|
||||
track[toaddress]=currenttime + cls.expire
|
||||
track[toaddress] = currenttime + self.expire
|
||||
list_of_time_track = list(key for (key, value) in track.items() if value < currenttime)
|
||||
for t in list_of_time_track:
|
||||
track.pop(t)
|
||||
for address in list_of_time_track:
|
||||
track.pop(address)
|
||||
self.delete_outbox_message()
|
||||
time.sleep(10)
|
||||
|
||||
def delete_outbox_message(self):
|
||||
print("hello sent dlt")
|
||||
"""Deleting Messages from Outbox Having Status ackreceived or msgsentnoackexpected"""
|
||||
SentMessage=json.loads(self.api.getAllSentMessages())
|
||||
sent_var=SentMessage.get('sentMessages')
|
||||
sentmessage = json.loads(self.api.getAllSentMessages())
|
||||
sent_var = sentmessage.get('sentMessages')
|
||||
for values in sent_var:
|
||||
status_ack_rcvd = values.get('status')
|
||||
ackData=values.get('ackData')
|
||||
ackdata = values.get('ackData')
|
||||
if status_ack_rcvd in ('ackreceived', 'msgsentnoackexpected'):
|
||||
self.api.trashSentMessageByAckData(ackData)
|
||||
|
||||
self.api.trashSentMessageByAckData(ackdata)
|
||||
|
||||
if __name__ == '__main__':
|
||||
BitmessageAutoresponder().send_autorepond_inbox_message()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user