dagdshort


Namedagdshort JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/impredicative/dagdshort/
SummaryMultithreaded concurrent da.gd URL shortener with in-memory cache
upload_time2022-12-08 18:47:22
maintainer
docs_urlNone
authorOuroboros Chrysopoeia
requires_python>=3.9
license
keywords da.gd url shortener
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dagdshort
**dagdshort** is a Python based multithreaded URL shortener with a memory-cache. It uses the [da.gd](https://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.

[![cicd badge](https://github.com/impredicative/dagdshort/workflows/cicd/badge.svg?branch=master)](https://github.com/impredicative/dagdshort/actions?query=workflow%3Acicd+branch%3Amaster)

## 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:
```python
>>> 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](https://github.com/dagd/dagd/issues). As an example, see [this](https://github.com/dagd/dagd/issues/50) issue.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/impredicative/dagdshort/",
    "name": "dagdshort",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "da.gd url shortener",
    "author": "Ouroboros Chrysopoeia",
    "author_email": "impredicative@users.nomail.github.com",
    "download_url": "https://files.pythonhosted.org/packages/9a/27/46a64c9c7ade79ea88dbd99beaccbce1c1502412641151d2be45f29e8f0e/dagdshort-0.2.0.tar.gz",
    "platform": null,
    "description": "# dagdshort\n**dagdshort** is a Python based multithreaded URL shortener with a memory-cache. It uses the [da.gd](https://da.gd/) service.\n\nAs 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.\n\nOther operations are outside the scope of this package.\n\n[![cicd badge](https://github.com/impredicative/dagdshort/workflows/cicd/badge.svg?branch=master)](https://github.com/impredicative/dagdshort/actions?query=workflow%3Acicd+branch%3Amaster)\n\n## Links\n| Caption   | Link                                                |\n|-----------|-----------------------------------------------------|\n| Repo      | https://github.com/impredicative/dagdshort/         |\n| Changelog | https://github.com/impredicative/dagdshort/releases |\n| Package   | https://pypi.org/project/dagdshort/                 |\n\n## Requirements\n\n### Python\nPython \u22653.9 is required. An older version of Python will not work.\n\n## Usage\nTo install the package, run:\n\n    $ pip install dagdshort\n\nUsage example:\n```python\n>>> import dagdshort\n\n# Setup\n>>> shortener = dagdshort.Shortener(user_agent_suffix='<YourGitUsername>/<YourGitRepoName>', max_cache_size=256)\n\n# Shorten\n>>> long_urls = ['https://github.com/impredicative/dagdshort/', 'https://pypi.org/project/dagdshort/']\n>>> shortener.shorten_urls(long_urls)\n{'https://github.com/impredicative/dagdshort/': 'https://da.gd/W9s06',\n 'https://pypi.org/project/dagdshort/': 'https://da.gd/KtGTB'}\n\n# Show cache info\n>>> shortener.cache_info\n{'Shortener._shorten_url': CacheInfo(hits=0, misses=2, maxsize=256, currsize=2)}\n```\n\nTo obtain the fastest response, URLs must be shortened together in a batch as in the examples above.\nUp 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.\n\n## Errors\nIf a \"Blacklisted long URL\" error is experienced for a reasonable website which should not be blacklisted, it can be reported [here](https://github.com/dagd/dagd/issues). As an example, see [this](https://github.com/dagd/dagd/issues/50) issue.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Multithreaded concurrent da.gd URL shortener with in-memory cache",
    "version": "0.2.0",
    "split_keywords": [
        "da.gd",
        "url",
        "shortener"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "9c986946739c851715415362433b4130",
                "sha256": "42dbeec05e78f5a0498de44f614d128cfbadce607a7ced32526a9f7d2e2a354b"
            },
            "downloads": -1,
            "filename": "dagdshort-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c986946739c851715415362433b4130",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 18879,
            "upload_time": "2022-12-08T18:47:21",
            "upload_time_iso_8601": "2022-12-08T18:47:21.271954Z",
            "url": "https://files.pythonhosted.org/packages/e2/26/bc0c3755f66c39e418ff2890e3abf39c3a26ab3672b650ac28b9945d6ef5/dagdshort-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "dec57f6f8b18041cceb6e3a901daf5d7",
                "sha256": "d77896560e5709b32bd191a443698af44c4c6972ddbe3a638b8cb123ebe0d261"
            },
            "downloads": -1,
            "filename": "dagdshort-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dec57f6f8b18041cceb6e3a901daf5d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 18572,
            "upload_time": "2022-12-08T18:47:22",
            "upload_time_iso_8601": "2022-12-08T18:47:22.688205Z",
            "url": "https://files.pythonhosted.org/packages/9a/27/46a64c9c7ade79ea88dbd99beaccbce1c1502412641151d2be45f29e8f0e/dagdshort-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-08 18:47:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "impredicative",
    "github_project": "dagdshort",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dagdshort"
}
        
Elapsed time: 0.01516s