Posts

Showing posts from October, 2021

How to Create Python Processor / Automated Task

Step-1: Create on python File ( module) Step-2:  This is Formate we need to used, add your logic ( .....ur logic) and If u want change sleep time to run or Automated Task every seconds/day/hours  import threading import time class ClassProcesses(threading.Thread):     def __init__(self, **kwargs):         threading.Thread.__init__(self) print('thread ID ----- ', threading.current_thread().ident) self.start()     def run(self):         print("RUN Method Started") while True: .....ur logic time.sleep(86400) # For 1 day         print("sleep time completed") if '__main__' == __name__:     ClassProcesses() Using this Schedule library u can easily run your code atomated import schedule class Test_1(): def run(): # schedule.every(2).minutes.do(self.contest_processor) schedule.every().day.at("00:00").do(excute_method) while True:       schedule.run_pending()   ...

How To Send SMS Using AWS SNS

import boto3 client = boto3.client(             "sns",             aws_access_key_id='',             aws_secret_access_key='',             region_name= ''         ) mobile_number = "+91 9999988888" Note: it will acept this following mobile number formates #+91 9999988888, +91-9999988888, +919999988888,+91-99999-88888, +9199999-88888, +9199999-88888, +91 9999988888              res = self.client.publish(PhoneNumber=mobile_no, Message=message) mess_id = res['MessageId'] res_status = res['ResponseMetadata'] status = res_status['HTTPStatusCode'] Note: To get aws access key & aws_secret_access_key, please follow this Article  - https://medium.com/codephilics/how-to-send-a-sms-using-amazon-simple-notification-service-sns-46208d82abcc