Skip to content

Commit e9b1bc2

Browse files
committed
Merge remote-tracking branch 'geekcomputers/master'
2 parents 7393481 + 9dd098e commit e9b1bc2

File tree

2 files changed

+87
-1
lines changed

2 files changed

+87
-1
lines changed

WikipediaModule

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
"""
2+
Created on Sat Jul 15 01:41:31 2017
3+
4+
@author: Albert
5+
"""
6+
import wikipedia as wk
7+
from bs4 import BeautifulSoup
8+
9+
def wiki():
10+
'''
11+
Search Anything in wikipedia
12+
'''
13+
14+
word=raw_input("Wikipedia Search : ")
15+
results=wk.search(word)
16+
for i in enumerate(results):
17+
print i
18+
try:
19+
key=input("Enter the number : ")
20+
except AssertionError:
21+
key=input("Please enter corresponding article number : ")
22+
23+
page=wk.page(results[key])
24+
url=page.url
25+
#originalTitle=page.original_title
26+
pageId=page.pageid
27+
#references=page.references
28+
title=page.title
29+
#soup=BeautifulSoup(page.content,'lxml')
30+
pageLength=input('''Wiki Page Type : 1.Full 2.Summary : ''')
31+
if pageLength==1:
32+
soup=fullPage(page)
33+
print soup
34+
else:
35+
print title
36+
print "Page Id = ",pageId
37+
print page.summary
38+
print "Page Link = ",url
39+
#print "References : ",references
40+
41+
42+
pass
43+
44+
def fullPage(page):
45+
soup=BeautifulSoup(page.content,'lxml')
46+
return soup
47+
48+
def randomWiki():
49+
'''
50+
This function gives you a list of n number of random articles
51+
Choose any article.
52+
'''
53+
number=input("No: of Random Pages : ")
54+
lst=wk.random(number)
55+
for i in enumerate(lst):
56+
print i
57+
try:
58+
key=input("Enter the number : ")
59+
assert key>=0 and key<number
60+
except AssertionError:
61+
key=input("Please enter corresponding article number : ")
62+
63+
page=wk.page(lst[key])
64+
url=page.url
65+
#originalTitle=page.original_title
66+
pageId=page.pageid
67+
#references=page.references
68+
title=page.title
69+
#soup=BeautifulSoup(page.content,'lxml')
70+
pageLength=input('''Wiki Page Type : 1.Full 2.Summary : ''')
71+
if pageLength==1:
72+
soup=fullPage(page)
73+
print soup
74+
else:
75+
print title
76+
print "Page Id = ",pageId
77+
print page.summary
78+
print "Page Link = ",url
79+
#print "References : ",references
80+
81+
pass
82+
83+
84+
85+
#if __name__=="__main__":
86+
# wiki()

env_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
conffilename = os.path.join(confdir, conffile) # Set the variable conffilename by joining confdir and conffile together
1616

1717
for env_check in open(conffilename): # Open the config file and read all the settings
18-
env_check = env_check.strip() # Set the variable as itsself, but strip the extra text out
18+
env_check = env_check.strip() # Set the variable as itself, but strip the extra text out
1919
print '[{}]'.format(env_check) # Format the Output to be in Square Brackets
2020
newenv = os.getenv(env_check) # Set the variable newenv to get the settings from the OS what is currently set for the settings out the configfile
2121

0 commit comments

Comments
 (0)