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 for sending the API request.

pyperclip is used to copy 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.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

lain_shorten-1.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lain_shorten-1.3.tar.gz
  • Upload date:
  • Size: 3.4 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.3.tar.gz
Algorithm Hash digest
SHA256 4a933546a1f767bfd7f60db715a147b4225c97b8758b676a4ef970a4d49536bf
MD5 48cb5324f0411ccbea3870ab8be4638c
BLAKE2b-256 f32546a561bc1bc705dcff2438b73631d9553dfeb563b7cc2e6bc4eb3cb08ed7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lain_shorten-1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aa2851865c999c3dd13decf8937a043cf0c45ccf224385f59e3d2cbb25e83054
MD5 14de8760c8fffc050129f34e9947ef4b
BLAKE2b-256 91ebf3156951ae877b0be74fa9a480da1b7a8f0a1c8675cfd3c8577cdc1861df

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