8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04b60f7 commit fbf19feCopy full SHA for fbf19fe
Ch5 - Internet Data/inetdata_finished.py
Ch5 - Internet Data/inetdata_start.py
@@ -1,10 +1,18 @@
1
-#
2
-# Example file for retrieving data from the internet
3
-# LinkedIn Learning Python course by Joe Marini
4
+import urllib.request
+
5
6
def main():
7
- pass # this is a placeholder, do-nothing statement
+ # open a connection to a URL using urllib2
+ url = "https://google.com"
+ weburl = urllib.request.urlopen(url)
8
9
+ # get the result code and print it
10
+ print("GET {} {}".format(url, weburl.getcode()))
11
12
+ # read the data from the URL and print it
13
+ data = weburl.read()
14
+ print("PAYLOAD {}".format(data))
15
16
17
if __name__ == "__main__":
18
main()
0 commit comments