这是引用的死亡验证码API文档我正在使用。你知道吗
dict deathbycaptcha.Client.decode(file imageFile, int timeout)
dict deathbycaptcha.Client.decode(str imageFileName, int timeout)
它可以接受图像文件的路径或文件对象
我有这行代码。你知道吗
client.decode(urllib.urlopen('https://example/image.jpg').read(), 30)
但是它给了我一个错误,因为.read()
确实返回了file-like
对象。你知道吗
我喜欢一行一行地做。你知道吗
有没有什么方法可以轻松地将read()
读取的流转换为类似文件的对象?你知道吗
如果不能像PHP (string) 100
那样在一行中实现,那么我将接受多行
我不确定
urllib.urlopen
,但是您可以使用urllib2.urlopen方法来获取可以传递给decode
函数的file-like
对象。它看起来或多或少像:编辑:我查看了urllib documentation,它看起来
urllib.urlopen
也返回file-like
对象。你知道吗相关问题 更多 >
编程相关推荐