本文整理汇总了Python中attrdict.AttrDict.user方法的典型用法代码示例。如果您正苦于以下问题:Python AttrDict.user方法的具体用法?Python AttrDict.user怎么用?Python AttrDict.user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类attrdict.AttrDict
的用法示例。
在下文中一共展示了AttrDict.user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_thread_page
# 需要导入模块: from attrdict import AttrDict [as 别名]
# 或者: from attrdict.AttrDict import user [as 别名]
def parse_thread_page(el: bs4.element.Tag) -> AttrDict:
out = AttrDict()
out.user = el.select('.postprofile dt')[0].text.strip()
out.body_html = str(el.select('.content')[0]).strip()
out.body_text = el.select('.content')[0].text.strip()
out.date = el.select('.postbody .author')[0].text.strip()
return out
示例2: start_mock_server80
# 需要导入模块: from attrdict import AttrDict [as 别名]
# 或者: from attrdict.AttrDict import user [as 别名]
def start_mock_server80():
"""Start a mock Tomcat Manager application
:returns: a tuple: (url, user, password) where the server is accessible
"""
# pylint: disable=unused-variable
# go find an unused port
sock = socket.socket(socket.AF_INET, type=socket.SOCK_STREAM)
sock.bind(('localhost', 0))
address, port = sock.getsockname()
sock.close()
tms = AttrDict()
tms.url = 'http://localhost:{}/manager'.format(port)
tms.user = USER
tms.password = PASSWORD
tms.warfile = '/path/to/server.war'
tms.contextfile = 'path/to/context.xml'
mock_server = HTTPServer(('localhost', port), MockRequestHandler80)
mock_server_thread = Thread(target=mock_server.serve_forever)
mock_server_thread.setDaemon(True)
mock_server_thread.start()
return tms
示例3: tomcat_manager_server
# 需要导入模块: from attrdict import AttrDict [as 别名]
# 或者: from attrdict.AttrDict import user [as 别名]
def tomcat_manager_server(request):
"""start a local http server which provides a similar interface to a real Tomcat Manager app"""
url = request.config.getoption('--url')
if url:
# use the server info specified on the command line
tms = AttrDict()
tms.url = url
tms.user = request.config.getoption('--user')
tms.password = request.config.getoption('--password')
tms.warfile = request.config.getoption('--warfile')
tms.contextfile = request.config.getoption('--contextfile')
return tms
else:
# go start up a fake server
return start_mock_server80()