Skip to content
TheOctoGirl edited this page Oct 28, 2023 · 3 revisions

Shortening URLs

To shorten a URL you can use the link.shorten() function to shorten a URL.

Example

from pygdshort import link

short_url = link.shorten(long_url = "https://example.com")

Optionally you can also add the custom_short_url parameter to the link.shorten() function to generate a custom short URL.

from pygdshort import link

short_url = link.shorten(long_url = "https://example.com", custom_short_url = "example")

When link.shorten() is run it will return the shortened URL in a string.

Expanding URLs

To expand a URL you can use the link.expand() function to expand a URL to its original URL.

Example

from pygdshort import link

long_link = link.expand(short_url = "https://is.gd/example")

When link.expand() is run it will return the expanded URL in a string.

Clone this wiki locally