[Answer]-ValueError : Unkown url type in Django

1👍

you probably only want to quote long_url and not the whole string

endpoint = 'https://api-ssl.bitly.com/v3/shorten?access_token={0}&longUrl={1}&format=txt'
req = endpoint.format(settings.ACCESS_KEY, urllib.quote(long_url))
return urlopen(req).read()

Leave a comment