예제 #1
0
    def __init__(self, file=None):
        if file is None:
            file = os.path.join(os.path.expanduser("~"), ".netrc")
        self.file = file
        if not os.path.exists(file):
            open(self.file, 'w').close()

        netrc.__init__(self, file)
예제 #2
0
 def __init__(self, *args, **kwargs):
     netrc_path = self.get_netrc_path()
     if not os.path.exists(netrc_path):
         open(netrc_path, 'a').close()
         os.chmod(netrc_path, 0o600)
     kwargs['file'] = netrc_path
     try:
         netrc.__init__(self, *args, **kwargs)
     except IOError:
         raise click.ClickException(
             "Please make sure your netrc config file ('{}') can be read "
             "and written by the current user.".format(netrc_path))
예제 #3
0
 def __init__(self, *args, **kwargs):
     netrc_path = self.get_netrc_path()
     if not os.path.exists(netrc_path):
         open(netrc_path, 'a').close()
         os.chmod(netrc_path, 0o600)
     kwargs['file'] = netrc_path
     try:
         netrc.__init__(self, *args, **kwargs)
     except IOError:
         raise click.ClickException(
             "Please make sure your netrc config file ('{}') can be read "
             "and written by the current user."
             .format(netrc_path)
         )
예제 #4
0
 def __init__(self, file=None):
     # The stdlib netrc doesn't find the right netrc file by default
     # work-around to fix that
     if file is None:
         file = self.find_default_file()
     _netrc.__init__(self, file=file)
예제 #5
0
 def __init__(self, file=None):
     if file is None:
         file = os.environ.get('NETRC')
     _netrc.__init__(self, file)