Python urllib.splittag() Examples

The following are 17 code examples of urllib.splittag(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module urllib , or try the search function .
Example #1
Source File: py26compat.py    From Financial-Portfolio-Flask with MIT License 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #2
Source File: test_urllib.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_splittag(self):
        splittag = urllib.splittag
        self.assertEqual(splittag('http://example.com?foo=bar#baz'),
                         ('http://example.com?foo=bar', 'baz'))
        self.assertEqual(splittag('http://example.com?foo=bar#'),
                         ('http://example.com?foo=bar', ''))
        self.assertEqual(splittag('#baz'), ('', 'baz'))
        self.assertEqual(splittag('http://example.com?foo=bar'),
                         ('http://example.com?foo=bar', None))
        self.assertEqual(splittag('http://example.com?foo=bar#baz#boo'),
                         ('http://example.com?foo=bar#baz', 'boo')) 
Example #3
Source File: py26compat.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #4
Source File: py26compat.py    From aws-kube-codesuite with Apache License 2.0 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #5
Source File: test_urllib.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_splittag(self):
        splittag = urllib.splittag
        self.assertEqual(splittag('http://example.com?foo=bar#baz'),
                         ('http://example.com?foo=bar', 'baz'))
        self.assertEqual(splittag('http://example.com?foo=bar#'),
                         ('http://example.com?foo=bar', ''))
        self.assertEqual(splittag('#baz'), ('', 'baz'))
        self.assertEqual(splittag('http://example.com?foo=bar'),
                         ('http://example.com?foo=bar', None))
        self.assertEqual(splittag('http://example.com?foo=bar#baz#boo'),
                         ('http://example.com?foo=bar#baz', 'boo')) 
Example #6
Source File: py26compat.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #7
Source File: py26compat.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #8
Source File: py26compat.py    From PhonePi_SampleServer with MIT License 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #9
Source File: py26compat.py    From Ansible with MIT License 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #10
Source File: py26compat.py    From jbox with MIT License 5 votes vote down vote up
def strip_fragment(url):
	"""
	In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
	later was patched to disregard the fragment when making URL requests.
	Do the same for Python 2.6 and earlier.
	"""
	url, fragment = splittag(url)
	return url 
Example #11
Source File: py26compat.py    From telegram-robot-rss with Mozilla Public License 2.0 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #12
Source File: py26compat.py    From Safejumper-for-Desktop with GNU General Public License v2.0 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #13
Source File: py26compat.py    From kobo-predict with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #14
Source File: py26compat.py    From lambda-chef-node-cleanup with Apache License 2.0 5 votes vote down vote up
def strip_fragment(url):
	"""
	In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
	later was patched to disregard the fragment when making URL requests.
	Do the same for Python 2.6 and earlier.
	"""
	url, fragment = splittag(url)
	return url 
Example #15
Source File: test_urllib.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_splittag(self):
        splittag = urllib.splittag
        self.assertEqual(splittag('http://example.com?foo=bar#baz'),
                         ('http://example.com?foo=bar', 'baz'))
        self.assertEqual(splittag('http://example.com?foo=bar#'),
                         ('http://example.com?foo=bar', ''))
        self.assertEqual(splittag('#baz'), ('', 'baz'))
        self.assertEqual(splittag('http://example.com?foo=bar'),
                         ('http://example.com?foo=bar', None))
        self.assertEqual(splittag('http://example.com?foo=bar#baz#boo'),
                         ('http://example.com?foo=bar#baz', 'boo')) 
Example #16
Source File: py26compat.py    From python-netsurv with MIT License 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url 
Example #17
Source File: py26compat.py    From python-netsurv with MIT License 5 votes vote down vote up
def strip_fragment(url):
    """
    In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
    later was patched to disregard the fragment when making URL requests.
    Do the same for Python 2.6 and earlier.
    """
    url, fragment = splittag(url)
    return url