<filename>lib/python3.9/site-packages/facebookinsights/utils/url.py<gh_stars>100-1000
# encoding: utf-8

import requests
try:
    # Python 2
    import urlparse as parse
    from urllib import urlencode as encode
except ImportError:
    # Python 3
    import urllib.parse as parse
    from urllib.parse import urlencode as encode

def resolve(url):
    response = requests.head(url, allow_redirects=True)
    return response.url

def base(url):
    base = parse.urlsplit(url)[:3]
    url = parse.urlunsplit(base + ('', ''))
    return url
<filename>lib/python3.9/site-packages/facebookinsights/utils/url.py<gh_stars>100-1000
# encoding: utf-8

import requests
try:
    # Python 2
    import urlparse as parse
    from urllib import urlencode as encode
except ImportError:
    # Python 3
    import urllib.parse as parse
    from urllib.parse import urlencode as encode

def resolve(url):
    response = requests.head(url, allow_redirects=True)
    return response.url

def base(url):
    base = parse.urlsplit(url)[:3]
    url = parse.urlunsplit(base + ('', ''))
    return url
# encoding: utf-8 # Python 2 # Python 3