PyBites-Open-Source / pybites-tools

A repo to commit common Python utility scripts and snippets
MIT License
18 stars 8 forks source link

dictionaryapi response changed + consider mocking out requests response #28

Closed bbelderbos closed 9 months ago

bbelderbos commented 2 years ago

@rhyspowell regarding the meaning tool, this test / API request now returns a 404 (instead of a 200):

        (
            argparse.Namespace(lang="de", origin=False, word="danke"),
            "zur Unterstreichung einer höflichen Ablehnung oder Annahme eines Angebots o. Ä.",
        ),

Also the API response seems to have changed since you wrote this tool causing the tests to fail:

> /Users/bbelderbos/code/pybites-tools/pybites_tools/meaning.py(28)get_meaning()
-> origin = "No origin information available"
(Pdb) "origin" in data[0]
False
(Pdb) type(data[0])
<class 'dict'>
(Pdb) data[0].keys()
dict_keys(['word', 'phonetic', 'phonetics', 'meanings', 'license', 'sourceUrls'])

Could you check please?

Thanks! Bob

rhyspowell commented 2 years ago

@bbelderbos Looks like they have scaled things back to just en. I will remove the german test but it might be a nice little project to recreate the tool but in python!

bbelderbos commented 2 years ago

Ah you mean to figure out what they are using and build our own API?

rhyspowell commented 2 years ago

https://github.com/PyBites-Open-Source/pybites-tools/pull/29

For fix

As for how they do it, they scrape google, I just looked at their code. We can't reuse it as its JS, well we could but thats not really python tools 😂

bbelderbos commented 2 years ago

OK thanks for fixing (approved) and checking, so we keep using them, or could we use a library like BeautifulSoup ourselves here?

bbelderbos commented 1 year ago

@rhyspowell do we want to make more changes for this issue?

rhyspowell commented 1 year ago

@bbelderbos will refresh where we were and see what I can do

bbelderbos commented 1 year ago

Cool, no rush on this of course

rhyspowell commented 1 year ago

@bbelderbos #37 for your approval. If it looks good there are more options that we can add