本文整理汇总了Python中SOAPpy.SOAPProxy.login方法的典型用法代码示例。如果您正苦于以下问题:Python SOAPProxy.login方法的具体用法?Python SOAPProxy.login怎么用?Python SOAPProxy.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SOAPpy.SOAPProxy
的用法示例。
在下文中一共展示了SOAPProxy.login方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GForgeProxy
# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import login [as 别名]
class GForgeProxy(object):
# URLs
url = 'https://gforge.inria.fr:443/soap/index.php'
urlwsdl = 'https://gforge.inria.fr/soap/index.php?wsdl'
namespace = 'https://gforge.inria.fr'
encoding = 'http://schemas.xmlsoap.org/soap/encoding/'
def __init__(self):
# SOAP proxy
self.server = SOAPProxy(self.url, namespace=self.namespace,
encoding='ISO-8859-1')
# Uncomment the following lines for SOAP Debug informations
# self.server.config.dumpSOAPOut = 1
# self.server.config.dumpSOAPIn = 1
# Global session id
self.session = None
self.userid = None
self.passwd = None
def login(self, userid=None, passwd=None):
""" Open a session """
from . import gforge_util
rc_userid, rc_passwd = gforge_util.find_login_passwd()
userid = userid or rc_userid
passwd = passwd or rc_passwd
try:
self.session = self.server.login(userid, passwd)
self.userid = userid
self.passwd = passwd
except Exception as e:
print(e)
return self.session
def logout(self):
""" Close the session """
self.server.logout(self.session)
self.session = None
def get_project_id(self, project_name):
"""
Return the project id (formely the group_id) for a particular name
Return -1 if failed
"""
try:
ret = self.server.getGroupsByName(self.session, [project_name])
id = ret[0]['group_id']
return id
except Exception:
return -1
def get_project_details(self, project_id):
"""
Return the project details in a dictionary
@param project_id : a number or a name
"""
project_id = self.convert_to_id(project_id)
ret = self.server.getGroups(self.session, [project_id])
id = ret[0]
return id
def get_packages(self, project_id):
"""
Return a list of package name
@param project_id : a number or a name
"""
(project_id,) = self.convert_to_id(project_id)
pkgs = self.server.getPackages(self.session, project_id)
return [pkg['name'] for pkg in pkgs]
def get_package_id(self, project_id, pkg_name):
"""
Return the package id, -1 if failed
@param project_id : a number or a name
"""
(project_id,) = self.convert_to_id(project_id)
pkg_name = pkg_name.lower()
try:
pkgs = self.server.getPackages(self.session, project_id)
for pkg in pkgs:
if (pkg['name'].lower() == pkg_name):
return pkg['package_id']
except:
pass
return -1
#.........这里部分代码省略.........
示例2: SOAPProxy
# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import login [as 别名]
#!/usr/bin/env python
from SOAPpy import SOAPProxy
# conectando diretamente
servico = SOAPProxy("http://localhost:8080")
usuario = raw_input('Usuario: ')
senha = raw_input('Senha: ')
user ={'usuario':usuario,'senha':senha}
#if servico.login(usuario,senha):
if servico.login(user):
print 'Login efetuado com sucesso'
else:
print 'O usuario nao existe ainda, cadastrando'
servico.registra(user)
示例3: SOAPProxy
# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import login [as 别名]
#############################################################################
# GForge Initialization
#############################################################################
# lookup tables for gforge stuff
gforge_users = {}
gforge_elements = {}
# setup GForge SOAP endpoint
from SOAPpy import SOAPProxy
GFapi = SOAPProxy(config.GFORGE_ENDPOINT_URL, namespace=config.GFORGE_XML_NAMESPACE)
# uncomment to see outgoing/incoming XML
#GFapi.config.debug = 1
# get GForge session
GFsession = GFapi.login( config.GFORGE_LOGIN , config.GFORGE_PASSWORD )
GFuserid = GFsession.split(":")[0]
# get GForge project
p = GFapi.getProjectByUnixName(GFsession, config.GFORGE_PROJECT)
# get all GForge trackers for this project
trackers = GFapi.getTrackers(GFsession, p.project_id, -1, -1)
#############################################################################
# GitHub Initialization
#############################################################################
github = Github( config.GITHUB_TOKEN )
github_user = github.get_user()
github_label_cache = {} # to avoid unnecessary API requests
if "/" in config.GITHUB_PROJECT:
owner_name, github_project = github_project.split("/")