urlopen (version 0.0.4)
index
urlopen.html

This package implements tools to build python package and tools.
 
>>> from urlopen import urlopen
>>> r = urlopen("http://google.com")
>>> r.code
200
>>> from urlopen import build_opener, httpcode
>>> @httpcode(301)
... def getstatuscode(s, r, f, c, m, h) -> int:
...     return c
...
>>> urlopen = build_opener().open
>>> urlopen("http://google.com")
301
>>>
 
>>> from urlopen import build_opener, httpcode
>>> @httpcode(200, 500)
... def getstatuscode(s, r, f, c, m, h) -> int:
...     return c
...
>>> urlopen = build_opener().open
>>> urlopen("https://google.com")
200
>>>

 
Modules
       
http.client

 
Classes
       
urllib.request.BaseHandler(builtins.object)
DefaultHandler

 
class DefaultHandler(urllib.request.BaseHandler)
    DefaultHandler(functions: Dict[int, collections.abc.Callable] = None)
 
This class implements the default handler
for PythonToolsKit.urlopen.urlopen.
 
 
Method resolution order:
DefaultHandler
urllib.request.BaseHandler
builtins.object

Methods defined here:
__init__(self, functions: Dict[int, collections.abc.Callable] = None)
Initialize self.  See help(type(self)) for accurate signature.
http_response(self, request: urllib.request.Request, response: http.client.HTTPResponse) -> None
httpcode(self, *args: collections.abc.Sequence[int]) -> collections.abc.Callable
This decorator change action on HTTP error
code.
https_response = http_response(self, request: urllib.request.Request, response: http.client.HTTPResponse) -> None

Data and other attributes defined here:
auth_header = 'Authorization'
max_redirections = 10
max_repeats = 4

Methods inherited from urllib.request.BaseHandler:
__lt__(self, other)
Return self<value.
add_parent(self, parent)
close(self)

Data descriptors inherited from urllib.request.BaseHandler:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from urllib.request.BaseHandler:
handler_order = 500

 
Functions
       
build_opener(functions: Dict[int, collections.abc.Callable] = None) -> urlopen.OpenerDirector
This function creates an opener object
using default handlers.
httpcode(*args: collections.abc.Sequence[int]) -> collections.abc.Callable
This decorator change action on HTTP error
code.

 
Data
        __all__ = ['httpcode', 'DefaultHandler', 'build_opener']
__annotations__ = {'FUNCTIONS_CODES': typing.Dict[int, collections.abc.Callable]}
__author_email__ = 'mauricelambert434@gmail.com'
__copyright__ = '\nPythonToolsKit Copyright (C) 2022 Maurice Lam...ome to redistribute it\nunder certain conditions.\n'
__description__ = '\nThis package implements tools to build python package and tools.\n'
__license__ = 'GPL-3.0 License'
__maintainer__ = 'Maurice Lambert'
__maintainer_email__ = 'mauricelambert434@gmail.com'
__url__ = 'https://github.com/mauricelambert/PythonToolsKit'

 
Author
        Maurice Lambert