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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lain_shorten-1.11-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lain_shorten-1.11.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for lain_shorten-1.11.tar.gz
Algorithm Hash digest
SHA256 635fb3029d1ffc8422a2145dcddd5b5224a338c1779f30c9f63892ebd9f45177
MD5 e6c4b665ad57cca586dbe9118c617012
BLAKE2b-256 2e6093591d0afaa336e5a62bdd72ba82e96a57f7925fc6e91d84d28a6a25e49d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lain_shorten-1.11-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for lain_shorten-1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 d6c55fa429a78dd5730f91930a522d379458aeee6431259c7c86873fab92e60e
MD5 1de7705274d9210b46986b13a89b385d
BLAKE2b-256 6fe46405e9bd52e9162d064b2dcd28e08d1f3fbe2b233f12c9a18d69b6e3b115

See more details on using hashes here.

Supported by

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