-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISBNdb Plugin #265
ISBNdb Plugin #265
Conversation
plugins/isbn.py
Outdated
@@ -0,0 +1,45 @@ | |||
import re | |||
import json, requests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need to import json as requests has a built in json method.
plugins/isbn.py
Outdated
url = url + book | ||
#print(url) | ||
resp = requests.get(url=url) | ||
data = json.loads(resp.text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be changed to
data = resp.json()
yup, But It still requires json module for getting dict from json str.
2017/04/18 午前7:10 "Andy Edwards" <notifications@github.com>:
… ***@***.**** commented on this pull request.
------------------------------
In plugins/isbn.py
<#265 (comment)>:
> +import cloudbot
+
***@***.***_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
<#265 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALa_EzGWXCXf1LElNvFgA-yqYij05iifks5rw-NmgaJpZM4M5X4B>
.
|
Requests has that built in though, with the |
Removed the json library from requirements.txt as it is not required.
I just pushed an update using |
I created a plugin to allow users to type ".isbn " and return information about the book from http://isbndb.com.