source: uri/uri.py@ 241

Last change on this file since 241 was 233, checked in by wouter, 4 years ago

rename ur.py to uri.py

File size: 845 bytes
RevLine 
[231]1from __future__ import annotations
2from rfc3986.api import uri_reference
3
4class URI:
5 def __init__(self, uri:str):
6 self._uri=uri
7 self._parse= uri_reference(uri)
8 self._normal=self._parse.normalize()
9
10 def getUri(self):
11 return self._uri
12
13 def getScheme(self):
14 return self._parse.scheme
15
16
17 def getHost(self):
18 return self._parse.host
19
20
21 def getPath(self):
22 return self._parse.path
23
24 def getQuery(self):
25 return self._parse.query
26
27 def getFragment(self):
28 return self._parse.fragment
29
30 def __repr__(self)->str:
31 return self._uri
32
33 def __eq__(self, other):
34 return isinstance(other, self.__class__) and \
35 self._normal==other._normal
36
37 def __hash__(self):
[232]38 return hash(self._normal)
[231]39
Note: See TracBrowser for help on using the repository browser.