I can get my own lists but not other users lists

瀏覽次數:66 次
跳到第一則未讀訊息

Andrew Tatham

未讀,
2016年3月2日 下午3:55:112016/3/2
收件者:Wordnik API

# using python 3.5 e.g. https://github.com/wordnik/wordnik-python3
from wordnik import swagger, WordApi, WordsApi, WordListApi, WordListsApi, AccountApi

apiUrl = 'http://api.wordnik.com/v4'
apiKey = "<my api key>"
client = swagger.ApiClient(apiKey, apiUrl)

account_api = AccountApi.AccountApi(client)
word_api = WordApi.WordApi(client)
words_api = WordsApi.WordsApi(client)
word_list_api = WordListApi.WordListApi(client)
word_lists_api = WordListsApi.WordListsApi(client)
username = "andrewtatham"
password = "<my password>"
auth_token = account_api.authenticate(username, password).token


# I can get my list ok e.g. https://wordnik.com/lists/hello-world
my_lists = account_api.getWordListsForLoggedInUser(auth_token)
for my_list in my_lists:
    print("{username}, {name}, {numberWordsInList}, {description}, {permalink}".format(**my_list.__dict__))
    list_words = word_list_api.getWordListWords(permalink=my_list.permalink, auth_token=auth_token)
    for word in list_words:
        print(word.word)

# andrewtatham, hello world, 2, this description intentionally left blank, hello-world
# world
# hello


# but I can't get other peoples lists e.g. https://wordnik.com/lists/twitter-loves
list_words = word_list_api.getWordListWords(permalink="twitter-loves", auth_token=auth_token)


# urllib.error.HTTPError: HTTP Error 403: Forbidden
#
# File "/Users/andrewtatham/twitterpibot/twitterpibot/logic/wordnikwrapper.py", line 34, in <module>
#   list_words = word_list_api.getWordListWords(permalink="twitter-loves", auth_token=auth_token)
# File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/wordnik/WordListApi.py", line 242, in getWordListWords
#   postData, headerParams)
# File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/wordnik/swagger.py", line 73, in callAPI
#   request = urllib.request.urlopen(requestParams)

Erin McKean

未讀,
2016年3月2日 下午4:35:042016/3/2
收件者:wordn...@googlegroups.com
Hi Andrew!

Sadly, this is not a bug but a feature. Other users' lists are not
available through the API at this point.

We are considering changing this for the next version of the API -- if
you could let us know a little bit more about the use case, that would
be great!

You probably won't be able to write to other users' public lists via the
API in the next version -- they'll be read-only.

Thanks!

Erin


On 3/2/16 12:55 PM, Andrew Tatham wrote:
>
> # using python 3.5 e.g. https://github.com/wordnik/wordnik-python3
> from wordnikimport swagger, WordApi, WordsApi, WordListApi, WordListsApi, AccountApi
>
> apiUrl ='http://api.wordnik.com/v4'
> apiKey = "<my api key>"
> client = swagger.ApiClient(apiKey, apiUrl)
>
> account_api = AccountApi.AccountApi(client)
> word_api = WordApi.WordApi(client)
> words_api = WordsApi.WordsApi(client)
> word_list_api = WordListApi.WordListApi(client)
> word_lists_api = WordListsApi.WordListsApi(client)
> username ="andrewtatham"
> password ="<my password>"
> auth_token = account_api.authenticate(username, password).token
>
>
> # I can get my list ok e.g. https://wordnik.com/lists/hello-world
> my_lists = account_api.getWordListsForLoggedInUser(auth_token)
> for my_listin my_lists:
> print("{username}, {name}, {numberWordsInList}, {description}, {permalink}".format(**my_list.__dict__))
> list_words = word_list_api.getWordListWords(permalink=my_list.permalink, auth_token=auth_token)
> for wordin list_words:
> print(word.word)
>
> # andrewtatham, hello world, 2, this description intentionally left
> blank, hello-world
> # world
> # hello
>
>
> # but I can't get other peoples lists e.g.
> https://wordnik.com/lists/twitter-loves
> list_words = word_list_api.getWordListWords(permalink="twitter-loves", auth_token=auth_token)
>
>
> # urllib.error.HTTPError: HTTP Error 403: Forbidden
> #
> # File
> "/Users/andrewtatham/twitterpibot/twitterpibot/logic/wordnikwrapper.py",
> line 34, in <module>
> # list_words =
> word_list_api.getWordListWords(permalink="twitter-loves",
> auth_token=auth_token)
> # File
> "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/wordnik/WordListApi.py",
> line 242, in getWordListWords
> # postData, headerParams)
> # File
> "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/wordnik/swagger.py",
> line 73, in callAPI
> # request = urllib.request.urlopen(requestParams)
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Wordnik API" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wordnik-api...@googlegroups.com
> <mailto:wordnik-api...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Andrew Tatham

未讀,
2016年3月2日 下午4:41:372016/3/2
收件者:Wordnik API

I hadn’t intended to add/remove words from the list. I wanted readonly access to these other lists to use as source data for a twitter bot of some kind. 


Hadn’t worked it out in any more detail than that yet. Was just finding interesting lists to use.


Any idea when the next version of the api will be? and what likelihood this feature will be in it?


Thanks

Erin McKean

未讀,
2016年3月2日 下午4:44:262016/3/2
收件者:wordn...@googlegroups.com
Thank you! This use-case is dear to our hearts (yay bots!) ... we don't
have a release date yet but "not before June" is the best I can say. :-)

If you like you can sign up for the beta-testing list here and get first
crack at testing it once it's up: http://eepurl.com/bPCg0D

I hope this helps!

Erin

Anthony Shore

未讀,
2018年6月6日 下午1:53:482018/6/6
收件者:Wordnik API
+1 for that feature request. I, too, would like to fetch words from others' lists.

No interest in using them for a bot. I’d like to train an RNN on words fetched from Wordnik lists.

Thank you!

- Anth

Erin McKean

未讀,
2018年6月6日 下午1:57:512018/6/6
收件者:wordn...@googlegroups.com
Cool! can I ask if you are interested specifically in other users'
lists, or would a set of lists on different topics also work? We're
trying to figure out the right balance between user content and
Wordnik content. :)

Thanks!

Erin
>> > <mailto:wordnik-api...@googlegroups.com>.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Wordnik API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to wordnik-api...@googlegroups.com.

Anthony Shore

未讀,
2018年6月8日 下午3:29:322018/6/8
收件者:Wordnik API
Generally, it’s fetching lists of a certain topic that I’m looking for. Some users and their lists are more exhaustive than others, some are more original than others. I’ll search for a word that is emblematic of a topic then look through the lists containing that word. There are a lot of false positives (I'm looking at you GRE and Twitterbot lists ad nauseum), so some curation on my part is both expected and welcome.

As I haven’t yet begun building my own lists on Wordnik, every list I browse is somebody else's.  

Thanks!

- Anth

Erin McKean

未讀,
2018年6月9日 凌晨12:08:352018/6/9
收件者:wordn...@googlegroups.com
Topic-based lists are definitely on our roadmap -- sorry I don't have
an ETA. When we have something to announce we'll do it first through
our beta announcements list: http://eepurl.com/bPCg0D

Thanks!

Erin
>> >> > <mailto:wordnik-api...@googlegroups.com>.
回覆所有人
回覆作者
轉寄
0 則新訊息