snippet of urlib3 code in python3
Python urlib3 is different than urllib and urllib2 Python module. Here is snippet of urllib3 code.
Ref : https://urllib3.readthedocs.io/en/latest/
import urllib3
def fetch_words():
url = 'http://sixty-north.com/c/t.txt' story_words = []
r = urllib3.PoolManager().request('GET', url)
story = r.data
for line in story.decode('utf-8').split('\n'):
line_words = line.split()
for word in line_words:
story_words.append(word)
return story_words
def print_words():
for word in fetch_words():
print(word)
if __name__ == '__main__':
print_words()
Ref : https://urllib3.readthedocs.io/en/latest/
Comments
Post a Comment