oxford.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:WordQuery 作者: finalion 项目源码 文件源码
def _get_from_api(self, lang="en"):
        word = self.word
        baseurl = "https://od-api.oxforddictionaries.com/api/v1"
        app_id = "45aecf84"
        app_key = "bb36fd6a1259e5baf8df6110a2f7fc8f"
        headers = {"app_id": app_id, "app_key": app_key}

        word_id = urllib2.quote(word.lower().replace(" ", "_"))
        url = baseurl + "/entries/" + lang + "/" + word_id
        url = urllib2.Request(url, headers=headers)
        response = json.loads(urllib2.urlopen(url).read())

        return response["results"]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号