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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lain_shorten-1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 3fefb277da264955954df8a3e0918b39b576db336b7d0c309d9552c8d1c5a1ad
MD5 8fa25d9e25822cc085c2fd8b72e910bd
BLAKE2b-256 7b362bfe370ed39c2edc036336e4ff89d943d10c4f9cf1a7be10791f78de200f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lain_shorten-1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 665be8dcbc8a0a11c0cc65559b9d6a0c0a496fa48ff9ef3573e9cab79011827a
MD5 fceadf01fffe1eb21021b859caa18a71
BLAKE2b-256 01cfcda2e9069486bd8fa076b5975bb0a4a25ea4cc8e6d72e72e714ba693cfe1

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