-
Notifications
You must be signed in to change notification settings - Fork 2
/
hseb2.py
executable file
·47 lines (36 loc) · 1.09 KB
/
hseb2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python2
from bs4 import BeautifulSoup
import sys
import requests
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def mainFunctions():
#taking input of symbol number
print "Enter the symbol number:",
number = raw_input()
#url of the site
url = "http://neb.ntc.net.np/result.php/"
#making post request with symbol number
req = requests.post(
url,
data = {"symbol": number}
)
#putting the response to req.text
response = req.text
#passing it through BeautifulSoup function
soup = BeautifulSoup(response, "html.parser")
#finding appropriate portion since the text is within div id show-result
res_div = soup.find_all("div", id="show-result")
# Looping through the result for looking another text
for div in res_div:
result = div.find("div").text
# returning the result
print bcolors.WARNING + result + bcolors.ENDC
mainFunctions()