impredicative / bitlyshortener Goto Github PK
View Code? Open in Web Editor NEW(discontinued)
Home Page: https://pypi.org/project/bitlyshortener/
License: GNU Affero General Public License v3.0
(discontinued)
Home Page: https://pypi.org/project/bitlyshortener/
License: GNU Affero General Public License v3.0
shortener.usage() method give organizations key error
Am I missing something?
is it possible to get link's stats?
I'm interested to get a sort list by clicks of all generated links by the pool tokens
Will you implemented this?
Thanks for your amazing great job!
How to use customize back half with this library?
Hello! I've used this library for months but I've always had a doubt: why doesn't it support bit.ly links but only j.mp ones? What would require to support other link formats as well?
Would it be possible, to append an s to http:// somehow programmatically?
Because bit.ly provides ssl links only with the premium account (branded links) and otherwise it would be required to copy the generated URL and append an s manually.
If this could be added to the package, it would be pretty nice.
What do you think?
Currently, bitlyshortener supports only Python 3.7+. Is there a reason for it? Can shortening happen serially if ThreadPoolExecutor
throws an error?
Python 3.6.9 is still very much used, as being, for instance, the standard version in Ubuntu 18.04 LTS.
I wanted to try to create an option to use the usual bit.ly or some other (possibly, user-supplied) custom domain instead of the default j.mp being used in the shortened link. Any way to do this?
>>> shortener.usage()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Shortener' object has no attribute 'usage'
In November 2022, an email was received from Bitly advising that the new link quota per free token is lowered to 50 per month (from its previous value of 1000 per month). As per the email, this change is effective on December 8, 2022.
The new quota is so low as to not be useful. For this reason, the maintenance of this package is being discontinued, although the package should continue to function with the limited new quota.
Users can consider switching to dagdshort as an alternative.
Hey, I am trying to install this library inside a Docker container but I have always the same error:
Collecting bitlyshortener
Could not find a version that satisfies the requirement bitlyshortener (from versions: )
No matching distribution found for bitlyshortener
root@8022d008f48a:/app#
any idea by there?
Hello,
I try to set up URL shortening in the following way:
Here I put the tokens_pool into [ ] brackets.
from bitlyshortener import Shortener
tokens_pool = ['my_general_access_token'] # is this correct?
shortener = Shortener(tokens=tokens_pool, max_cache_size=8192)
@usr_account.route("/account/createtable", methods=["POST"])
def account_createtable():
form = CreateTableForm(request.form)
if form.validate():
tableid = DB.add_table(form.tablenumber.data, current_user.get_id())
new_url = config.base_url + "newrequest/" + tableid
short_url = shortener.shorten_urls(new_url)
DB.update_table(tableid, short_url)
return redirect(url_for('account.account'))
return render_template("account.html", createtableform=form, tables=DB.get_tables(current_user.get_id()))
This gives me the following error:
https://gist.github.com/mark-schulze/3fff041cc761a8f019b42b4e51ac59bd
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api-ssl.bitly.com/v4/shorten
and
bitlyshortener.exc.RequestError: The response status code is 400 and so the request will not be reattempted. The error is: HTTPError: 400 Client Error: Bad Request for url: https://api-ssl.bitly.com/v4/shorten
I'm not sure if I properly bind in the access_token or what could cause the error.
If you could help me here, it would be great.
Thanks
Not sure if the bit.ly API supports this, but it would be great to be able to generate URLs also from letters like [ä,ö,ü,§,%,"], so having utf-8 support would be nice.
Hello,
I try to set up URL shortening in the following way:
from bitlyshortener import Shortener
tokens_pool = 'my_general_access_token' # is this correct?
shortener = Shortener(tokens=tokens_pool, max_cache_size=8192)
@usr_account.route("/account/createtable", methods=["POST"])
def account_createtable():
form = CreateTableForm(request.form)
if form.validate():
tableid = DB.add_table(form.tablenumber.data, current_user.get_id())
new_url = config.base_url + "newrequest/" + tableid
short_url = shortener.shorten_urls(new_url)
DB.update_table(tableid, short_url)
return redirect(url_for('account.account'))
return render_template("account.html", createtableform=form, tables=DB.get_tables(current_user.get_id()))
This gives me the following error:
https://gist.github.com/mark-schulze/b02b9c77dd45046dc932eaf195e4bf34
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api-ssl.bitly.com/v4/bitlinks
and
bitlyshortener.exc.RequestError: Exhausted all 30 attempts requesting response from 30 for long URL h. The error is: HTTPError: 403 Client Error: Forbidden for url: https://api-ssl.bitly.com/v4/bitlinks
I'm not sure if I properly bind in the access_token or what could cause the error.
If you could help me here, it would be great.
I do get another error, I post a separated issue for that.
Thanks
When I tried to convert following url to short URL from bitly website
https://www.amazon.in/Surf-Excel-Matic-Detergent-Powder/dp/B00TS88UZW
I got short url like https://amzn.to/3ho0Inp this, but when I convert by using bitlyshortner library,
I am getting short url like this https://j.mp/2FbsN2Y, I know as per documentation this is also bitly shorter, but is it possible to shorter link as similar we get on bitly website?
I am able to achieve this by using their API in my python code, but I really like this library, so curious to know is it possible to do similar in this library?
I'm trying to run a simple example:
>>> from bitlyshortener import Shortener
>>> import os
>>> tokens_pool = [ os.environ["BITLY_TOKEN"] ]
>>> shortener = Shortener(tokens=tokens_pool, max_cache_size=8192)
But I get the error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
shortener = Shortener(tokens=tokens_pool, max_cache_size=8192)
File "/home/jmerelo/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/bitlys
hortener/shortener.py", line 27, in __init__
self._init_executor()
File "/home/jmerelo/.pyenv/versions/3.7-dev/lib/python3.7/site-packages/bitlys
hortener/shortener.py", line 69, in _init_executor
initializer=self._init_requests_session)
TypeError: __init__() got an unexpected keyword argument 'initializer'
Any idea?
Tried processing only one long url twice:
File "C:\python\lib\site-packages\bitlyshortener\shortener.py", line 270, in shorten_urls
rate_per_second = num_short_urls / time_used
ZeroDivisionError: float division by zero
My manual solution editing "shortener.py" at line 270:
try:
rate_per_second = num_short_urls / time_used
except ZeroDivisionError:
rate_per_second = 1
It would be great to have an analytics feature for getting the number of clicks as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.