我想做一个HTTP包装抽搐.tv在python中。我该怎么做?我知道如何使用httpget,仅此而已。我希望它像这样工作:
import twichtvwrapper
twich = twichtvwrapper(useragent, username, password).
channel = twich.channel(channelname)
所有的json属性都会放在这里,比如:
print(channel.game) #this would say the last played game
print(channel.displayname) #this would print the display name of the channel
print(cahnnel.link.chat) #this will return the chat link
等等
我该怎么做这个包装纸呢?你知道吗
可以使用标准库的
json
模块在Python dict和JSON字符串之间进行转换。你知道吗因此,如果您的程序从HTTP请求获得JSON响应,只需将其转换为dict,然后使用常规的Python dict方法来完成其余的工作。你知道吗
相关问题 更多 >
编程相关推荐