Skip to content

Instantly share code, notes, and snippets.

@rahulnegi20
Created May 17, 2021 11:42
Show Gist options
  • Save rahulnegi20/5d1b54c68e8f5fdd30bf9dfd0ac55195 to your computer and use it in GitHub Desktop.
Save rahulnegi20/5d1b54c68e8f5fdd30bf9dfd0ac55195 to your computer and use it in GitHub Desktop.
import os
import sys
import urllib.request, urllib.parse, urllib.error
import json
print('++++++++++Terminal Based google-dictionary++++++++++\n')
title=os.environ["word"]
flag = 0
print('\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\START\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \n')
print ("Word: ",title )
try :
url = 'https://api.dictionaryapi.dev/api/v2/entries/en_US/'+title
result = json.load(urllib.request.urlopen(url))
except urllib.error.HTTPError as e: ResponseData = 'failed'
except :
print('Connect to-- Internet!! ', sys.exc_info()[0])
os._exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment