Ejemplo n.º 1
0
def get(job_info,**comm_kwargs):

    #print comm_kwargs

    comm = Comm(job_info, **comm_kwargs)
    comm.set_attr(log_file_name="BCCard_crawl_profile.log")

    for t in range(DEFAULT_RETRY_COUNT):
        comm = get_attempt(comm)

        try:
            if comm.driver:
                comm.driver.quit()
                comm.driver = None
        except:
            comm.add_err("ERROR_RETRIABLE_problem_in_closing_webdriver", tb_msg=traceback.format_exc(), SC=True)
            return comm

        if comm.last_e_msg == "OK":
            comm.logger.error(">>>ALL PROCESS IS DONE")
            return comm
        elif "ERROR_DO_NOT_RETRY" in comm.last_e_msg:
            return comm
        else:
            time.sleep(5)
    comm.add_err("ERROR_DO_NOT_RETRY_retry_count_exceed")
    return comm
Ejemplo n.º 2
0
def get(job_info, **comm_kwargs):

    comm = Comm(job_info, **comm_kwargs)
    comm.set_attr(url="https://spib.wooribank.com/pib/Dream?withyou=CMLGN0001",
                  log_file_name="Woori_crawl_profile.log")

    for t in range(DEFAULT_RETRY_COUNT):
        comm = get_attempt(comm)

        if comm.last_e_msg == "OK":
            comm.logger.error(">>>ALL PROCESS IS DONE")
            return comm
        elif "ERROR_DO_NOT_RETRY" in comm.last_e_msg:
            return comm
        else:
            time.sleep(5)
    comm.add_err("ERROR_DO_NOT_RETRY_retry_count_exceed")
    return comm
Ejemplo n.º 3
0
def main():
    args = parse_args()

    ros_is_on = args['ros']
    port = args['port']
    baud = args['baud']
    traj = args['traj']
    step_is_on = args['step']

    logString(list_ports())

    logString("Attempting connection to embedded")
    logString("\tPort: " + port)
    logString("\tBaud rate: " + str(baud))

    num_tries = 0
    comm = Comm()
    while (True):
        try:
            with serial.Serial(port, baud, timeout=0) as ser:
                logString("Connected")
                comm.start_up(ser, ros_is_on, traj, step_is_on)
                comm.begin_event_loop()

        except serial.serialutil.SerialException as e:
            if (num_tries % 100 == 0):
                if (str(e).find("FileNotFoundError")):
                    logString(
                        "Port not found. Retrying...(attempt {0})".format(
                            num_tries))
                else:
                    logString(
                        "Serial exception. Retrying...(attempt {0})".format(
                            num_tries))

            time.sleep(0.01)
            num_tries = num_tries + 1
Ejemplo n.º 4
0
                    comm.driver.quit()
                    comm.driver = None
            except:
                comm.add_err("ERROR_DO_NOT_RETRY_problem_in_webdriver", tb_msg=traceback.format_exc(), SC=True)
                return comm
            return comm
        else:
            time.sleep(10)
            try:
                if comm.driver:
                    comm.driver.quit()
                    comm.driver = None
            except:
                comm.add_err("ERROR_DO_NOT_RETRY_problem_in_webdriver", tb_msg=traceback.format_exc(), SC=True)
                return comm

    return comm

if __name__ == "__main__":

    job_info = {'creds': {'cred_user_id': 'murane', 'cred_user_pw': 'Tpsxl40!', 'cred_acc_no': '110385994336'}}
    comm = Comm(job_info)
    comm.set_attr(url="https://open.shinhan.com/index.jsp", isEncoded=False)
    comm = login(comm)

    print comm.last_e_msg




Ejemplo n.º 5
0
from Comm import Comm
import os
import time

numOfPeers = 1  # number of peers to talk to
CommComp1 = Comm(numOfPeers)  # instantiate the Comm class
CommComp1.do(numOfPeers, [
    os.path.join('.', 'fileTran', 'entity_1'),
    os.path.join('.', 'fileTran', 'entity_2')
], [
    os.path.join('.', 'fileRecv', 'entity_1'),
    os.path.join('.', 'fileRecv', 'entity_2')
], ['10.206.203.243', '10.152.144.160'])

########################################################################################
print '.......simulation going on.........'
time.sleep(5)
print '.....simulation done. ready for transmission .........'
########################################################################################

CommComp2 = Comm(numOfPeers)  # instantiate the Comm class
CommComp2.do(numOfPeers, [
    os.path.join('.', 'fileTran', 'entity_2'),
    os.path.join('.', 'fileTran', 'entity_2')
], [
    os.path.join('.', 'fileRecv', 'entity_2'),
    os.path.join('.', 'fileRecv', 'entity_2')
], ['10.206.203.243', '10.152.144.160'])

########################################################################################
print '.......simulation going on.........'