File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 4242 u'http://مثال.إختبار' ,
4343 u'http://例子.测试' ,
4444 u'http://उदाहरण.परीक्षा' ,
45+ u'http://www.😉.com' ,
46+ u'http://😉.com/😁' ,
47+ u'http://উদাহরণ.বাংলা' ,
48+ u'http://xn--d5b6ci4b4b3a.xn--54b7fta0cc' ,
4549 u'http://-.~_!$&\' ()*+,;=:%40:80%2f::::::@example.com' ,
4650 u'http://1337.net' ,
4751 u'http://a.b-c.de' ,
4852 u'http://223.255.255.254' ,
53+ u'http://10.1.1.0' ,
4954 u'http://10.1.1.1' ,
5055 u'http://10.1.1.254' ,
56+ u'http://10.1.1.255' ,
5157 u'http://127.0.0.1:8080' ,
5258 u'http://127.0.10.150' ,
5359 u'http://localhost' ,
@@ -114,8 +120,6 @@ def test_returns_true_on_valid_public_url(address, public):
114120 'http://-a.b.co' ,
115121 'http://a.b-.co' ,
116122 'http://0.0.0.0' ,
117- 'http://10.1.1.0' ,
118- 'http://10.1.1.255' ,
119123 'http://224.1.1.1' ,
120124 'http://1.1.1.1.1' ,
121125 'http://123.123.123' ,
Original file line number Diff line number Diff line change 33from .utils import validator
44
55ip_middle_octet = r"(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5]))"
6- ip_last_octet = r"(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4 ]))"
6+ ip_last_octet = r"(?:\.(?:0| [1-9]\d?|1\d\d|2[0-4]\d|25[0-5 ]))"
77
88regex = re .compile ( # noqa: W605
99 r"^"
6969 r"(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
7070 r")\]|"
7171 # host name
72- r"(?:(?:[a-z\u00a1-\uffff0-9]-?)*[a-z\u00a1-\uffff0-9]+)"
72+ r"(?:(?:(?:xn--)|[a-z\u00a1-\uffff\U00010000-\U0010ffff0-9]-?)*"
73+ r"[a-z\u00a1-\uffff\U00010000-\U0010ffff0-9]+)"
7374 # domain name
74- r"(?:\.(?:[a-z\u00a1-\uffff0-9]-?)*[a-z\u00a1-\uffff0-9]+)*"
75+ r"(?:\.(?:(?:xn--)|[a-z\u00a1-\uffff\U00010000-\U0010ffff0-9]-?)*"
76+ r"[a-z\u00a1-\uffff\U00010000-\U0010ffff0-9]+)*"
7577 # TLD identifier
76- r"(?:\.(?:[a-z\u00a1-\uffff]{2,}))"
78+ r"(?:\.(?:(?:xn--[a-z\u00a1-\uffff\U00010000-\U0010ffff0-9]{2,})|"
79+ r"[a-z\u00a1-\uffff\U00010000-\U0010ffff]{2,}))"
7780 r")"
7881 # port number
7982 r"(?::\d{2,5})?"
8083 # resource path
81- u"(?:/[-a-z\u00a1 -\uffff 0 -9._~%!$&'()*+,;=:@/]*)?"
84+ u"(?:/[-a-z\u00a1 -\uffff \U00010000 - \U0010ffff 0 -9._~%!$&'()*+,;=:@/]*)?"
8285 # query string
8386 r"(?:\?\S*)?"
8487 # fragment
You can’t perform that action at this time.
0 commit comments