def set_request_attr(req, name, value, default):
    try:
        getattr(req, name)
    except __HOLE__:
        setattr(req, name, default)
    if value is not default:
        setattr(req, name, value)
dataset/ETHPy150Open Masood-M/yalih/mechanize/_opener.py/set_request_attr