Log In | Get Help   
Home My Page Projects Code Snippets Project Openings BonFIRE VCOC Demonstration Kit
Summary Activity SCM Files Wiki
[bonfiredemokit] View of /ea/credentials.py
[bonfiredemokit] / ea / credentials.py Repository:
ViewVC logotype

View of /ea/credentials.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (as text) (annotate)
Mon Aug 27 11:46:35 2012 UTC (11 years, 9 months ago) by agomez
File size: 772 byte(s)
import os

def getpass(file):
	filepath=os.path.expanduser(file)
	password=None
	try:
		f=open(filepath,'r')
		for line in f.readlines(): 
			if line.find('password') == 0 :
				password=line.split()[1]
	except IOError:
		print 'ERROR: You must include your credentials in ' + file
		exit()
	if password == None:
		print 'ERROR: You must include your password in ' + file
		exit()
		
	return password

def getuser(file):
	user=None
	filepath=os.path.expanduser(file)
	try:
		f=open(filepath,'r')
		for line in f.readlines(): 
			if line.find('user') == 0 :
				user=line.split()[1]
	except IOError:
		print 'ERROR: You must include your credentials in ' + file
		exit()
	if user == None:
		print 'ERROR: You must include your username in ' + file
		exit()
		
	return user

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge