Need help with wordnik-python?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

211 Stars 44 Forks 106 Commits 8 Opened issues


Wordnik Python public library

Services available


Need anything else?

Contributors list

Python 2.7 client for API


This is a Python 2.7 client for the v4 API. For more information, see . This client has been generated using the Swagger code generator, which builds robust API clients and beautiful API documentation automatically. If you'd like to learn more about Swagger, visit (but you don't need to know anything about Swagger to simply use this API client for Wordnik, this page will tell get you up to speed on that account).

If you need help after reading the below, please find us on Google Groups at , @wordnikapi on Twitter, or on #wordnik on IRC.

Basic Setup

You should be able to install using

in the usual ways:
$ easy_install wordnik
$ pip install wordnik

Or just clone this repository and place the

folder that you downloaded somewhere where it can be accessed by your scripts. Create a connection as follows:
from wordnik import *
apiUrl = ''
client = swagger.ApiClient(apiKey, apiUrl)

You'll want to substitute your own personal API key, of course. If you don't have an API key yet, you can get one here: .

Calling a Method

Once you have a client set up, you need to instantiate an API object for whichever category or categories of items you are interested in working with. For example, to work with the

API and apply the method
method, you can do the following:
wordApi = WordApi.WordApi(client)
example = wordApi.getTopExample('irony')
print example.text

To find out what arguments the method expects, consult the online, interactive documentation at , and also check out the method definitions in


You can find out what fields to expect in the return value by using the interactive docs. You can also check out the tests in the

folder in this repository; each method is shown and tested there. In this case, the documentation in
shows that
returns an instance of
, so you would examine that class in

Some methods, like

, also take optional keyword parameters which should be specified by name. Again, these are shown in the online documentation and in the method defintions.
wordApi = WordApi.WordApi(client)
definitions = wordApi.getDefinitions('badger',
print definitions[0].text

The variable

is now an list of instances of the
class defined in
, as indicated in the documentation for


The tests require you to set three environment variables:

$ export API_KEY=your api key
$ export USER_NAME=some username
$ export PASSWORD=the user's password

The tests can be run as follows:

$ python tests/


Copyright 2013 Reverb Technologies, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.