searchapi /searchapi/duckduckgo.py

Language Python Lines 17
MD5 Hash 0aec9d8572b9243af86c9245f9c886e6 Estimated Cost $306 (why?)
Repository https://bitbucket.org/agiliq/searchapi View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import urllib
try:
    import json
except ImportError:
    import simplejson as json
class Duck(object):
	def __init__(self):
		self.end_point='http://api.duckduckgo.com/?q='
	
	def duckduckgo(self,query):
		query_string = urllib.quote_plus(query)
		final_url = self.end_point + query_string + '&format=json&pretty=1'
		response = urllib.urlopen(final_url)
		data = json.load(response)
		return data
		
Back to Top