Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/Meaning_Grepper/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UD_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
13 changes: 13 additions & 0 deletions scripts/Meaning_Grepper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## py_Online_Meaning_Grepper
Simple Python Program for finding meaning of the word.
> Uses https://rapidapi.com/community/api/urban-dictionary for API Calls.
### Requirements
```bash
pip install json requests python_dotenv
```

### Run Program
```bash
python script.py
```

3 changes: 3 additions & 0 deletions scripts/Meaning_Grepper/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
json
requests
python-dotenv
32 changes: 32 additions & 0 deletions scripts/Meaning_Grepper/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import requests
import json
import os
from dotenv import load_dotenv

load_dotenv()

UD_API_KEY = os.environ.get("UD_API_KEY")

word = str(input("Enter Word : "))

url = "https://mashape-community-urban-dictionary.p.rapidapi.com/define"

querystring = {"term":word}

headers = {
"X-RapidAPI-Key": UD_API_KEY,
"X-RapidAPI-Host": "mashape-community-urban-dictionary.p.rapidapi.com"
}

response = requests.request("GET", url, headers=headers, params=querystring)
json_str = json.dumps(response.text)
y = json.loads(response.text)
print(
"\n",
"Showing Results for", y["list"][0]["word"], "\n",
"Definition : ", y["list"][0]["definition"], "\n",
"Permalink " , y["list"][0]["permalink"], "\n",
"Written On : " , y["list"][0]["written_on"], "\n",
"Example : " , y["list"][0]["example"], "\n",
"Author : " , y["list"][0]["author"], "\n",
)