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

Uploaded Source

Built Distribution

lain_shorten-1.7-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lain_shorten-1.7.tar.gz
Algorithm Hash digest
SHA256 490923120f4a749aff31c65b7d6ee9761d86938f44d56789be1dd8bbb91f3471
MD5 f839e1a2035569b1b10f660e8ce18350
BLAKE2b-256 28ed4db3070d48482af611d4d20ff7200b6a78a7f4d8a762ccd192d2af17fa19

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for lain_shorten-1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 26bd4d27adee4e43f1ab6189f1ab98ad100e5cbd15853e53e97d2399c5b541b4
MD5 31f2c6c6182f73d796c1c4617ab6f214
BLAKE2b-256 15ae2968b116865a89a4083cbe4f78ada0e110e1238b86aee06a426020ff1f5c

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