Ejemplo n.º 1
0
def PlatformCheck(event):
    Fields = event["fields"]
    Channel = Fields['Channel']
    for platform in Channel:
        print (platform)
        if platform.lower() == "twitter":
            print ("run TWT")
            TWT.main(event)
        elif platform.lower() == "facebook":
            print ("run FB")
            FB.main(event)
        elif platform.lower() == "instagram":
            print ("run IG")
            IG.main(event)
        else:
            ############WRITE CONFIG FILES ##################
            ###     Writes the event info to errors.cfg   ###
            #################################################
            print("ERROR : invalid platform")
            conf = ConfigParser.RawConfigParser()
            start = event['start'].get('dateTime', event['start'].get('date'))
            conf.add_section('Wrong Platform')
            info =  str(start)+"|"+str(event['summary'])+"|"+str(event['description'])
            conf.set('Wrong Platform', info)
            # Writing our configuration file to 'errors.cfg'
            with open('Lib/errors.cfg', 'wb') as configfile:
                conf.write(configfile)