MCPcopy Index your code
hub / github.com/clips/pattern / __init__

Method __init__

pattern/web/__init__.py:248–275  ·  view source on GitHub ↗

URL object with the individual parts available as attributes: For protocol://username:password@domain:port/path/page?query_string#anchor: - URL.protocol: http, https, ftp, ... - URL.username: username for restricted domains. - URL.password: password f

(self, string=u"", method=GET, query={}, **kwargs)

Source from the content-addressed store, hash-verified

246class URL(object):
247
248 def __init__(self, string=u"", method=GET, query={}, **kwargs):
249 """ URL object with the individual parts available as attributes:
250 For protocol://username:password@domain:port/path/page?query_string#anchor:
251 - URL.protocol: http, https, ftp, ...
252 - URL.username: username for restricted domains.
253 - URL.password: password for restricted domains.
254 - URL.domain : the domain name, e.g. nodebox.net.
255 - URL.port : the server port to connect to.
256 - URL.path : the server path of folders, as a list, e.g. ['news', '2010']
257 - URL.page : the page name, e.g. page.html.
258 - URL.query : the query string as a dictionary of (name, value)-items.
259 - URL.anchor : the page anchor.
260 If method is POST, the query string is sent with HTTP POST.
261 """
262 self.__dict__["method"] = method # Use __dict__ directly since __setattr__ is overridden.
263 self.__dict__["_string"] = u(string)
264 self.__dict__["_parts"] = None
265 self.__dict__["_headers"] = None
266 self.__dict__["_redirect"] = None
267 if isinstance(string, URL):
268 self.__dict__["method"] = string.method
269 self.query.update(string.query)
270 if len(query) > 0:
271 # Requires that we parse the string first (see URL.__setattr__).
272 self.query.update(query)
273 if len(kwargs) > 0:
274 # Requires that we parse the string first (see URL.__setattr__).
275 self.parts.update(kwargs)
276
277 def _parse(self):
278 """ Parses all the parts of the URL string to a dictionary.

Callers 15

__init__Method · 0.45
clearMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 2

lenFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected