Skip to main content

URL Shortener using s.lain.la API.

Project description

lain.la-link-shortener

URL Shortener using s.lain.la API.

Requirements

requests is used to send the API request.

pyperclip is used to copy the link to the clipboard.

If you want to build this on your own, you can install the requirements with

pip install -r requirements.txt

or install the package by running

pip install lain-shorten

Python's native re (used to check validity of the url), argparse (parse return request and set command argument) and setuptools (used to build the script) packages are also used.

How it works

s.lain.la can shorten URLs using curl. I tend to forget the curl syntax and arguments quite easily, so I made a Python package to streamline things. Below is the aforementioned curl command.

curl -X POST -d 'url=https://yoururlhere.com' https://s.lain.la

I just wrapped it inside Python and added validation to check for links and copied the return address to clipboard for ease of use.

You can run the script with

lain-shorten <your-url-here>

I added support for links not starting with http/https as well.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lain_shorten-1.10.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

lain_shorten-1.10-py3-none-any.whl (12.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page