Ejemplo n.º 1
0
def main():
    baseDir = 'C:/Users/Administrator/Documents/Individual Agreements/'
        
    filemanager = FileManager.fileManager(baseDir)
    Drive = DriveManager.driveManager()
    GS = GoogleSheet.googleSheet()
    ProcessedID = GS.ReadProcessedID()

    while True:
        ###########################################################################
        Gmail = MessageManager.gmail('2018/10/28','credentials_gmail1')
        ###########################################################################
        UnreadID = Gmail.getAllIDs()
        Process = set(UnreadID)-set(ProcessedID)
        
        for I in Process:
            print(I)
            mess = MessageManager.emailMessage(I,Gmail)
            try:
                ia = IndividualAgreement.individualAgreement( Gmail, filemanager, Drive,I)
                li= ia.ReportResult()
            except:
                try:
                    ia = IndividualAgreement.individualAgreement( Gmail, filemanager, Drive,I)
                    li= ia.ReportResult()
                except:
                    li = [I,mess.getSubject(),mess.getFullName(),mess.getEmailAddress(),mess.getCountryName(), None, None, None,None,None,mess.getPlatform()]
                    print('failed')
            print(li)
            GS.updateInformation([li])
            ProcessedID.append(I)
    def test_driveManager(self):

        DM = DriveManager.driveManager()
        # =============================================================================
        print('get foldre ID')
        print(DM.getFolderID('MT5 Accounts'))

        print('get file id')
        print(DM.getFileID(' 323523>>Xin Liu>>ID translation'))

        print('get all folders in mt4 account')
        print(DM.getAllFolders('MT4 accounts'))

        print('get all files in the folder')
        print(DM.getAllFiles('705046 KAZUTAKA ARITOMI'))

        print('create folder')
        DM.CreateFolder('test')

        time.sleep(5)
        print('check existence of created folder')
        print(DM.CheckFolderExistence('test'))
        #DM.UploadFile('test','C:/Users/Intern/Desktop/','tradeview_logo.png')
        print('create the same folder')
        DM.CreateFolder('test')
        # =============================================================================
        DM.CopyRiskMatrix('Munemichi Ishikawa')
 def test_individualAgreement(self):
     baseDir = 'C:/Users/Administrator/Documents/Individual Agreements/'
     
     filemanager = FileManager.fileManager(baseDir)
     G = MessageManager.gmail('2018/10/22','credentials_gmail1')
     Drive = DriveManager.driveManager()
     ID = '166cc3673644d500'
     ia = IndividualAgreement.individualAgreement( G, filemanager, Drive,ID)
     print(ia.ReportResult())