Lines Matching refs:parse
4 import urllib.parse
86 result = urllib.parse.urlparse(url)
92 result2 = urllib.parse.urlunparse(result)
98 result3 = urllib.parse.urlparse(result.geturl())
113 result = urllib.parse.urlsplit(url)
118 result2 = urllib.parse.urlunsplit(result)
123 result3 = urllib.parse.urlsplit(result.geturl())
138 result = urllib.parse.parse_qsl(orig, keep_blank_values=True)
141 result = urllib.parse.parse_qsl(orig, keep_blank_values=False)
147 result = urllib.parse.parse_qs(orig, keep_blank_values=True)
151 result = urllib.parse.parse_qs(orig, keep_blank_values=False)
230 self.assertEqual(urllib.parse.urljoin(base, relurl), expected)
233 self.assertEqual(urllib.parse.urljoin(baseb, relurlb), expectedb)
239 self.assertEqual(urllib.parse.urlunsplit(urllib.parse.urlsplit(u)), u)
240 self.assertEqual(urllib.parse.urlunparse(urllib.parse.urlparse(u)), u)
292 self.assertEqual(urllib.parse.urlparse('mailto:1337@example.org'),
489 urlparsed = urllib.parse.urlparse(url)
500 self.assertRaises(ValueError, urllib.parse.urlparse, invalid_url)
519 result = urllib.parse.urldefrag(url)
526 p = urllib.parse.urlsplit('http://[FE80::822a:a8ff:fe49:470c%tESt]:1234')
530 p = urllib.parse.urlsplit(b'http://[FE80::822a:a8ff:fe49:470c%tESt]:1234')
536 p = urllib.parse.urlsplit(url)
552 p = urllib.parse.urlsplit(url)
569 p = urllib.parse.urlsplit(url)
583 p = urllib.parse.urlsplit(url)
596 p = urllib.parse.urlsplit(url)
609 p = urllib.parse.urlsplit(url)
623 p = urllib.parse.urlsplit(url)
630 for parse in (urllib.parse.urlsplit, urllib.parse.urlparse):
632 with self.subTest(bytes=bytes, parse=parse, port=port):
638 p = parse(url)
650 p = urllib.parse.urlsplit(uri)
658 p = urllib.parse.urlparse(uri)
668 p = urllib.parse.urlsplit(uri)
676 p = urllib.parse.urlparse(uri)
686 self.assertEqual(urllib.parse.urlparse("http://example.com?blahblah=/foo"),
688 self.assertEqual(urllib.parse.urlparse(b"http://example.com?blahblah=/foo"),
696 self.assertEqual(urllib.parse.urlparse("path"),
698 self.assertEqual(urllib.parse.urlparse("//www.python.org:80"),
700 self.assertEqual(urllib.parse.urlparse("http://www.python.org:80"),
703 self.assertEqual(urllib.parse.urlparse(b"path"),
705 self.assertEqual(urllib.parse.urlparse(b"//www.python.org:80"),
707 self.assertEqual(urllib.parse.urlparse(b"http://www.python.org:80"),
712 self.assertEqual(urllib.parse.urlparse("path:80"),
714 self.assertEqual(urllib.parse.urlparse("http:"),('http','','','','',''))
715 self.assertEqual(urllib.parse.urlparse("https:"),('https','','','','',''))
716 self.assertEqual(urllib.parse.urlparse("http://www.python.org:80"),
719 self.assertEqual(urllib.parse.urlparse(b"path:80"),
721 self.assertEqual(urllib.parse.urlparse(b"http:"),(b'http',b'',b'',b'',b'',b''))
722 self.assertEqual(urllib.parse.urlparse(b"https:"),(b'https',b'',b'',b'',b'',b''))
723 self.assertEqual(urllib.parse.urlparse(b"http://www.python.org:80"),
728 self.assertRaises(TypeError, urllib.parse.urlencode, "foo")
732 self.assertEqual(urllib.parse.urlparse("s3://foo.com/stuff"),
734 self.assertEqual(urllib.parse.urlparse("x-newscheme://foo.com/stuff"),
736 self.assertEqual(urllib.parse.urlparse("x-newscheme://foo.com/stuff?query#fragment"),
738 self.assertEqual(urllib.parse.urlparse("x-newscheme://foo.com/stuff?query"),
742 self.assertEqual(urllib.parse.urlparse(b"s3://foo.com/stuff"),
744 self.assertEqual(urllib.parse.urlparse(b"x-newscheme://foo.com/stuff"),
746 self.assertEqual(urllib.parse.urlparse(b"x-newscheme://foo.com/stuff?query#fragment"),
748 self.assertEqual(urllib.parse.urlparse(b"x-newscheme://foo.com/stuff?query"),
753 for func in (urllib.parse.urlparse, urllib.parse.urlsplit):
781 for func in (urllib.parse.urlparse, urllib.parse.urlsplit):
782 if attr == "params" and func is urllib.parse.urlsplit:
803 urllib.parse.urlparse("www.python.org", b"http")
805 urllib.parse.urlparse(b"www.python.org", "http")
807 urllib.parse.urlsplit("www.python.org", b"http")
809 urllib.parse.urlsplit(b"www.python.org", "http")
811 urllib.parse.urlunparse(( b"http", "www.python.org","","","",""))
813 urllib.parse.urlunparse(("http", b"www.python.org","","","",""))
815 urllib.parse.urlunsplit((b"http", "www.python.org","","",""))
817 urllib.parse.urlunsplit(("http", b"www.python.org","","",""))
819 urllib.parse.urljoin("http://python.org", b"http://python.org")
821 urllib.parse.urljoin(b"http://python.org", "http://python.org")
851 urllib.parse.DefragResult,
852 urllib.parse.SplitResult,
853 urllib.parse.ParseResult,
859 result = urllib.parse.parse_qs("key=\u0141%E9", encoding="latin-1")
861 result = urllib.parse.parse_qs("key=\u0141%C3%A9", encoding="utf-8")
863 result = urllib.parse.parse_qs("key=\u0141%C3%A9", encoding="ascii")
865 result = urllib.parse.parse_qs("key=\u0141%E9-", encoding="ascii")
867 result = urllib.parse.parse_qs("key=\u0141%E9-", encoding="ascii",
872 result = urllib.parse.parse_qsl("key=\u0141%E9", encoding="latin-1")
874 result = urllib.parse.parse_qsl("key=\u0141%C3%A9", encoding="utf-8")
876 result = urllib.parse.parse_qsl("key=\u0141%C3%A9", encoding="ascii")
878 result = urllib.parse.parse_qsl("key=\u0141%E9-", encoding="ascii")
880 result = urllib.parse.parse_qsl("key=\u0141%E9-", encoding="ascii",
886 urllib.parse.parse_qs('&'.join(['a=a']*11), max_num_fields=10)
888 urllib.parse.parse_qs(';'.join(['a=a']*11), max_num_fields=10)
889 urllib.parse.parse_qs('&'.join(['a=a']*10), max_num_fields=10)
894 result = urllib.parse.urlencode({'a': [1, 2], 'b': (3, 4, 5)}, True)
902 result = urllib.parse.urlencode({'a': Trivial()}, True)
906 result = urllib.parse.urlencode({'a': 'some value'})
908 result = urllib.parse.urlencode({'a': 'some value/another'},
909 quote_via=urllib.parse.quote)
911 result = urllib.parse.urlencode({'a': 'some value/another'},
912 safe='/', quote_via=urllib.parse.quote)
916 self.assertRaises(TypeError, urllib.parse.quote_from_bytes, 'foo')
917 result = urllib.parse.quote_from_bytes(b'archaeological arcana')
919 result = urllib.parse.quote_from_bytes(b'')
923 result = urllib.parse.unquote_to_bytes('abc%20def')
925 result = urllib.parse.unquote_to_bytes('')
929 self.assertRaises(TypeError, urllib.parse.quote, b'foo',
931 self.assertRaises(TypeError, urllib.parse.quote, b'foo', errors='strict')
934 p1 = urllib.parse.urlsplit('tel:+31-641044153')
937 p2 = urllib.parse.urlsplit('tel:+31641044153')
941 p1 = urllib.parse.urlparse('tel:+31-641044153')
944 p2 = urllib.parse.urlparse('tel:+31641044153')
949 p1 = urllib.parse.urlparse('tel:123-4;phone-context=+1-650-516')
954 p1 = urllib.parse.urlparse('tel:+1-201-555-0123')
959 p1 = urllib.parse.urlparse('tel:7042;phone-context=example.com')
964 p1 = urllib.parse.urlparse('tel:863-1234;phone-context=+1-914-555')
970 quoter = urllib.parse.Quoter(urllib.parse._ALWAYS_SAFE)
981 for name in dir(urllib.parse):
984 object = getattr(urllib.parse, name)
987 self.assertCountEqual(urllib.parse.__all__, expected)
1009 urllib.parse.urlsplit(url)
1016 splittype = urllib.parse.splittype
1024 splithost = urllib.parse.splithost
1053 splituser = urllib.parse.splituser
1068 splitpasswd = urllib.parse.splitpasswd
1084 splitport = urllib.parse.splitport
1095 splitnport = urllib.parse.splitnport
1109 splitquery = urllib.parse.splitquery
1119 splittag = urllib.parse.splittag
1131 splitattr = urllib.parse.splitattr
1142 splitvalue = urllib.parse.splitvalue
1150 result = urllib.parse.to_bytes('http://www.python.org')
1152 self.assertRaises(UnicodeError, urllib.parse.to_bytes,
1156 url = urllib.parse.unwrap('<URL:type://host/path>')