dagdshort
dagdshort is a Python based multithreaded URL shortener with a memory-cache. It uses the da.gd service.
As a disclaimer, this is an unofficial package and it has no association with da.gd. If you use this package extensively, making a financial donation to da.gd is encouraged.
Other operations are outside the scope of this package.
Links
| Caption | Link |
|---|---|
| Repo | https://github.com/impredicative/dagdshort/ |
| Changelog | https://github.com/impredicative/dagdshort/releases |
| Package | https://pypi.org/project/dagdshort/ |
Requirements
Python
Python ≥3.9 is required. An older version of Python will not work.
Usage
To install the package, run:
$ pip install dagdshort
Usage example:
>>> import dagdshort
# Setup
>>> shortener = dagdshort.Shortener(user_agent_suffix='<YourGitUsername>/<YourGitRepoName>', max_cache_size=256)
# Shorten
>>> long_urls = ['https://github.com/impredicative/dagdshort/', 'https://pypi.org/project/dagdshort/']
>>> shortener.shorten_urls(long_urls)
{'https://github.com/impredicative/dagdshort/': 'https://da.gd/W9s06',
'https://pypi.org/project/dagdshort/': 'https://da.gd/KtGTB'}
# Show cache info
>>> shortener.cache_info
{'Shortener._shorten_url': CacheInfo(hits=0, misses=2, maxsize=256, currsize=2)}
To obtain the fastest response, URLs must be shortened together in a batch as in the examples above.
Up to 8 concurrent workers are automatically used. The max limit can, if really necessary, be changed by setting config.MAX_WORKERS before initializing the shortener.
Errors
If a "Blacklisted long URL" error is experienced for a reasonable website which should not be blacklisted, it can be reported here. As an example, see this issue.
Metadata
Release files for dagdshort 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dagdshort-0.2.0.tar.gz | 18.6 kB | Without provenance | Details for dagdshort-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dagdshort-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dagdshort-0.2.0-py3-none-any.whl |
Total release size: 37.5 kB
Release files / dagdshort-0.2.0.tar.gz
| Download URL | dagdshort-0.2.0.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d77896560e5709b32bd191a443698af44c4c6972ddbe3a638b8cb123ebe0d261
|
|
BLAKE2b-256 checksum How to use checksums |
9a2746a64c9c7ade79ea88dbd99beaccbce1c1502412641151d2be45f29e8f0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / dagdshort-0.2.0-py3-none-any.whl
| Download URL | dagdshort-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42dbeec05e78f5a0498de44f614d128cfbadce607a7ced32526a9f7d2e2a354b
|
|
BLAKE2b-256 checksum How to use checksums |
e226bc0c3755f66c39e418ff2890e3abf39c3a26ab3672b650ac28b9945d6ef5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for dagdshort 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.