我试图缩短url在python中的位数。
到目前为止,这是我的代码:
import SETTINGS
import bitly_api
b = bitly_api.Connection(access_token=SETTINGS.API_KEY)
response = b.shorten(uri=full_url)
print response
return response['url']我得到的错误是:
File "/Users/Mac/Dropbox/01_MACBOOK/01_Development/02_PYTHON/03_EmailFromPage/bitly.py", line 11, in get_bitly_url
response = b.shorten(uri=full_url)
File "/Library/Python/2.7/site-packages/bitly_api/bitly_api.py", line 87, in shorten
data = self._call(self.host, 'v3/shorten', params, self.secret)
File "/Library/Python/2.7/site-packages/bitly_api/bitly_api.py", line 789, in _call
data.get('status_txt', 'UNKNOWN_ERROR'))
bitly_api.bitly_api.BitlyError: INVALID_ARG_ACCESS_TOKEN发布于 2014-09-28 03:01:32
也许你是那种可以从“做”中学习的人,所以,这里有一个很棒的课程,介绍如何利用CodeAcademy中的bitly的API。
http://www.codecademy.com/en/tracks/bitly
发布于 2019-10-02 00:16:02
这可能会有所帮助,https://medium.com/swlh/a-case-for-shortening-your-aws-pre-signed-urls-fc638dc1b47e文章将向您介绍如何使用bit.ly API v4。官方的python bit.ly https://github.com/bitly/bitly-api-python似乎没有得到支持,他们似乎也没有在谷歌支持论坛上做出回应。
client = BitlyBasicAuthClient()
response = client.shorten_url(yourUrlHere, yourGroupIdHere)
shortened_url = json.dumps(response, sort_keys=True, indent=4, separators=(',', ': '))
print(shortened_url)https://stackoverflow.com/questions/26074043
复制相似问题