Closed K0HAX closed 5 years ago
yup, But It still requires json module for getting dict from json str.
2017/04/18 午前7:10 "Andy Edwards" notifications@github.com:
@edwardslabs commented on this pull request.
In plugins/isbn.py https://github.com/CloudBotIRC/CloudBot/pull/265#discussion_r111833165:
+import cloudbot + +@hook.on_start() +def load_api(bot):
- global isbndb_key
- global cx
- isbndb_key = bot.config.get("api_keys", {}).get("isbndb_dev_key", None)
+def getISBN(book):
- try:
- url = "http://isbndb.com/api/v2/json/{}/book/".format(isbndb_key)
- url = url + book
print(url)
- resp = requests.get(url=url)
- data = json.loads(resp.text)
this could be changed to
data = resp.json()
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CloudBotIRC/CloudBot/pull/265#pullrequestreview-33102917, or mute the thread https://github.com/notifications/unsubscribe-auth/ALa_EzGWXCXf1LElNvFgA-yqYij05iifks5rw-NmgaJpZM4M5X4B .
Requests has that built in though, with the response.json()
method - no need to depend directly on json?
I just pushed an update using response.json()
, I've tested that method and it worked.
I created a plugin to allow users to type ".isbn" and return information about the book from http://isbndb.com.