23 lines
528 B
Python
23 lines
528 B
Python
|
"""Fisture class for page functions."""
|
||
|
|
||
|
from urllib import request
|
||
|
from urllib.error import HTTPError
|
||
|
|
||
|
class Page:
|
||
|
"""Class for getting an individual page."""
|
||
|
|
||
|
def __init__(self):
|
||
|
"""Init function."""
|
||
|
self.res = None
|
||
|
|
||
|
def request_url(self, url):
|
||
|
"""Make a page request."""
|
||
|
try:
|
||
|
self.res = request.urlopen(url)
|
||
|
except HTTPError as err:
|
||
|
self.res = err
|
||
|
|
||
|
def get_status_code(self):
|
||
|
"""Return the status code."""
|
||
|
return self.res.status
|