Commits

Jason R. Coombs committed 766513c

Use new API in Wordnik 2.1

  • Participants
  • Parent commits c3cf374

Comments (0)

Files changed (2)

File pmxbot/util.py

 	import urllib2 as urllib_request
 
 try:
-	import wordnik.api.APIClient
-	import wordnik.api.WordAPI
-	import wordnik.model
+	import wordnik.swagger
+	import wordnik.WordApi
 except ImportError:
 	warnings.warn("Wordnik failed to import")
 
 	'''
 	# Jason's key - do not abuse
 	key = 'edc4b9b94b341eeae350e087c2e05d2f5a2a9e0478cefc6dc'
-	client = wordnik.api.APIClient.APIClient(key, 'http://api.wordnik.com/v4')
-	words = wordnik.api.WordAPI.WordAPI(client)
-	input = wordnik.model.WordDefinitionsInput.WordDefinitionsInput()
-	input.word = word
-	input.limit = 1
-	definitions = words.getDefinitions(input)
+	client = wordnik.swagger.ApiClient(key, 'http://api.wordnik.com/v4')
+	words = wordnik.WordApi.WordApi(client)
+	definitions = words.getDefinitions(word, limit=1)
 	if not definitions:
 		return
 	definition = definitions[0]
 		return None
 	complist = match.group()
 	return complist
-	
+
 
 def passagg(recipient='', sender=''):
 	adj = random.choice(pmxbot.phrases.adjs)
 		"pyyaml",
 		"feedparser",
 		"pytz",
-		"wordnik>=2.0,<3.0",
+		"wordnik>=2.1.2,<3.0",
 		"jaraco.util",
 		"beautifulsoup4",
 		#for viewer