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.5.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

lain_shorten-1.5-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file lain_shorten-1.5.tar.gz.

File metadata

  • Download URL: lain_shorten-1.5.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for lain_shorten-1.5.tar.gz
Algorithm Hash digest
SHA256 cd4f13f41b340e51e98376b3c9ab7d67c547f298b75c34ce6cba36c9abe05a94
MD5 9a1c5a0fcb62f91539acb7b6be08dd7f
BLAKE2b-256 8e1f16b1cf3e79f9ad782a7d8b16643c56e693617b6773ff6439f5d67a2480d6

See more details on using hashes here.

File details

Details for the file lain_shorten-1.5-py3-none-any.whl.

File metadata

  • Download URL: lain_shorten-1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for lain_shorten-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 764dc3ef8c8969ca57d80a0e365a23c73acc97710ccd272500cd08f17b5987f5
MD5 ce0f3f6898bc0023e5c4259aaed086b4
BLAKE2b-256 fb09bc6b2701272a4f2504efd27adf06a1055fdff7d5fd2148bc5b0e83ed55a9

See more details on using hashes here.

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