我对新的 RDAP 协议以及何时进一步追求它感到有些困惑。在我看来,每个人都同意它成为 whois 的继任者,但他们的数据库似乎是空的。在 ubuntu 上,我尝试了 rdapper、nicinfo 甚至他们的 RESTful API:
http://rdap.org/domain/google.com (这会导致“找不到文件”,但根据此处是正确的)
我误解了什么吗?RDAP 死了,服务还没有启动还是我做错了什么?Nicinfo 返回这个:
nicinfo -t domain google.com
# NicInfo v.1.1.0-alpha
# Query yielded no results.
[ NOTICE ] Terms of Service
1 By using the ARIN RDAP/Whois service, you are agreeing to the RDAP/Whois
Terms of Use
About https://www.arin.net/whois_tou.html
[ ERROR ] DOMAIN NOT FOUND
Code 404
1 The domain you are seeking as 'google.com.' is/are not here.
Run Code Online (Sandbox Code Playgroud)
rdapper 返回这个:
rdapper --TYPE domain google.com
Error: …Run Code Online (Sandbox Code Playgroud) 我在python 2.7(在linux下)编写了一个类,它使用多个进程异步操作数据库。我遇到当使用一个很奇怪的阻塞行为multiprocessing.Queue.put()和multiprocessing.Queue.get()我无法解释。
这是我所做的简化版本:
from multiprocessing import Process, Queue
class MyDB(object):
def __init__(self):
self.inqueue = Queue()
p1 = Process(target = self._worker_process, kwargs={"inqueue": self.inqueue})
p1.daemon = True
started = False
while not started:
try:
p1.start()
started = True
except:
time.sleep(1)
#Sometimes I start a same second process but it makes no difference to my problem
p2 = Process(target = self._worker_process, kwargs={"inqueue": self.inqueue})
#blahblah... (same as above)
@staticmethod
def _worker_process(inqueue):
while True:
#--------------this blocks depite data having arrived------------
op …Run Code Online (Sandbox Code Playgroud) 在我看来,一个线程无缘无故地突然停止执行,并且再也没有恢复或重新启动。这种行为的可能原因是什么?不会抛出任何异常。至少没有检测到或打印出异常。它只是在没有任何信息的情况下停止。我的 pygtk GUI 和其他一切继续运行,没有问题。
它仅限于一段代码,但它发生在该段内的任何地方。以下代码在该线程内运行。我在我的代码中插入了很多打印,因为我无法调试它。调试器也会冻结。并且在没有调试器的情况下运行不会改变它(所以这不是调试的一些副作用)
count = 0
while True:
count = count + 1
#read results calculated by another thread. Done via Queue.Queue
pos, phrase, site, extractor, infoextractor, image = self.htmlqueue.get(True)
print "\"", threading.currentThread(), "\"", site, image["link"], infoextractor.__class__.__name__ , FileDownloader.nbdownloads, count
print "1"
#if Nones are found in the queue it means that there will be no more data
if pos is None and phrase is None and site is None and extractor is None and infoextractor is None …Run Code Online (Sandbox Code Playgroud) 我使用python 2.7,我从服务器接收一个字符串(不是在unicode!).在该字符串中,我找到了带有unicode转义序列的文本.例如这样:
<a href = "http://www.mypage.com/\u0441andmoretext">\u00b2<\a>
Run Code Online (Sandbox Code Playgroud)
我如何将这些转换\uxxxx回utf-8?我找到的答案要么是处理要么是&#要求eval(),这对我来说太慢了.我需要一个包含这种序列的任何文本的通用解决方案.
编辑:这
<\a>是一个错字,但我也想要对这种拼写错误进行容忍.应该只有反应\u
示例文本用适当的python语法表示如下:
"<a href = \"http://www.mypage.com/\\u0441andmoretext\">\\u00b2<\\a>"
Run Code Online (Sandbox Code Playgroud)
所需的输出是适当的python语法
"<a href = \"http://www.mypage.com/\xd1\x81andmoretext\">\xc2\xb2<\\a>"
Run Code Online (Sandbox Code Playgroud)