Created
May 17, 2021 11:42
-
-
Save rahulnegi20/5d1b54c68e8f5fdd30bf9dfd0ac55195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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