本文整理汇总了Python中core.data.parsers.url.URL.querystring方法的典型用法代码示例。如果您正苦于以下问题:Python URL.querystring方法的具体用法?Python URL.querystring怎么用?Python URL.querystring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.data.parsers.url.URL
的用法示例。
在下文中一共展示了URL.querystring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: met_search
# 需要导入模块: from core.data.parsers.url import URL [as 别名]
# 或者: from core.data.parsers.url.URL import querystring [as 别名]
def met_search(self, query):
"""
Query a Public Key Server.
This method is based from the pks.py file from the massive enumeration toolset,
coded by pdp and released under GPL v2.
"""
url = URL(u"http://pgp.mit.edu:11371/pks/lookup")
url.querystring = {u"op": u"index", u"search": query}
response = self._uri_opener.GET(url, headers=self._headers, cache=True, grep=False)
content = response.get_body()
content = re.sub("(<.*?>|<|>)", "", content)
results = []
accounts = []
for line in content.split("\n")[2:]:
if not line.strip():
continue
tokens = line.split()
if len(tokens) >= 5:
email = tokens[-1]
name = " ".join(tokens[3:-1])
# Copy+paste from baseparser.py
email_regex = "([A-Z0-9\._%-]{1,45}@([A-Z0-9\.-]{1,45}\.){1,10}[A-Z]{2,4})"
if re.match(email_regex, email, re.IGNORECASE):
account = email.split("@")[0]
domain = email.split("@")[1]
if domain == query:
if account not in accounts:
accounts.append(account)
pksr = PKSResult(name, account, domain, response.id)
results.append(pksr)
return results