
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Wordsapy is a python integration for the WordsAPI, that allows developers to retrieve information about English words like a dictionary.
Wordsapy is a python integration for the WordsAPI, that allows developers to retrieve information about English words like a dictionary.
Wordsapy is available on the Python Package Index (PyPI): https://pypi.python.org/pypi/wordsapy
You can install wordsapy using pip.
$ pip install wordsapy
In order to use WordsAPI you need an API Key.
Get you Free API Key: https://rapidapi.com/dpventures/api/wordsapi/pricing
Initialize a Dictionary
object and set your API Key.
from wordsapy import Dictionary
dictionary = Dictionary(api_key='your_api_key')
In this way the API Key will be defined as an environment variable, so with doing it only once is more than enough. Alternatively, you can export your API key as an environment variable.
$ export WORDS_API_KEY='your_api_key'
See examples/api_key.py for other examples.
Once done, you can use the Dictionary
object instance to perform queries.
Most methods of the Dictionary
class have the same name as WordsAPI endpoints.
Check out the API Documentation: https://www.wordsapi.com/docs/
Assuming that the API Key is already defined as an environment variable, we retrieve the definitions of the word: example.
from wordsapy import Dictionary
dictionary = Dictionary()
results = dictionary.definitions('example')
for result in results:
print('Definition: ' + result.definition)
print('Part of speech: ' + result.partOfSpeech)
All responses will return a DictObj
object or a list
object. All dict
objects in the response will be transformed into DictObj
. You can access to the data of a DictObj
object as you would with a dict
object, or do it through the attributes. An example to illustrate this:
dictionary = Dictionary()
word = dictionary.word('example')
# It is the same::
for word['results'][0]['definition']
for word.results[0]['definition']
for word['results'][0].definition
for word.results.[0].definition # I love this one
# DictObj is iterable:
for key, value in word.items():
print(key)
print(value)
All usage examples can be found in the /examples folder of the project
You can run the tests via the command line. Your API Key must have been exported as an environment variable.
Place your terminal at the root of the project and run the following command.
$ python -m unittest discover tests "*_test.py"
@AnthonyBloomer by tmdbv3api, with which I learned how to create a python interface for an API. The wordsapy structure is based on his library.
FAQs
Wordsapy is a python integration for the WordsAPI, that allows developers to retrieve information about English words like a dictionary.
We found that wordsapy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.