File tree 3 files changed +33
-0
lines changed
3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ __author__ = "Mahtab Alam"
2
+
3
+
4
+ from urllib .request import urlopen
5
+ from urllib .error import HTTPError , URLError
6
+
7
+ try :
8
+ url = urlopen ("http://www.abcxyz.com" )
9
+ except HTTPError :
10
+ print ("Http Error" )
11
+ except URLError :
12
+ print ("Server not find" )
13
+ else :
14
+ print (url .read ())
Original file line number Diff line number Diff line change
1
+ # Write a Python program to download and display the content of robot.txt for en.wikipedia.org.
2
+
3
+ import requests
4
+
5
+ url = requests .get ("https://en.wikipedia.org/robots.txt" )
6
+ print ("Robots.txt for Wikipedia" )
7
+ print ("==========================================" )
8
+
9
+ print (url .text )
Original file line number Diff line number Diff line change
1
+ import requests
2
+ from bs4 import BeautifulSoup
3
+
4
+ url = requests .get ("http://www.example.com/" )
5
+
6
+ soup = BeautifulSoup (url .text , 'html.parser' )
7
+
8
+ print (soup .h1 )
9
+
10
+
You can’t perform that action at this time.
0 commit comments