fshlink 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fshlink-1.0.0/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 maxeepy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
fshlink-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: fshlink
3
+ Version: 1.0.0
4
+ Summary: FshLink API Wrapper written in Python
5
+ Author: maxie
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://codeberg.org/maxeepy/fshlink-wrapper
8
+ Project-URL: Issues, https://codeberg.org/maxeepy/fshlink-wrapper/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: requests>=2.30
20
+ Dynamic: license-file
21
+
22
+ # fshlink
23
+
24
+ a wrapper written in python for https://link.fsh.plus/
25
+
26
+ ```py
27
+ from fshlink import FshLinkWrapper
28
+
29
+ fsh = FshLinkWrapper()
30
+
31
+ orig_link = fsh.get_url("ND8nulaEot") # will return a FshOriginalLink object
32
+ print(orig_link.url) # https://example.com
33
+
34
+ short_link = fsh.shorten_url("https://example.com") # will return a FshShortenedLink object
35
+ print(short_link.url) # https://link.fsh.plus/ND8nulaEot
36
+ ```
@@ -0,0 +1,15 @@
1
+ # fshlink
2
+
3
+ a wrapper written in python for https://link.fsh.plus/
4
+
5
+ ```py
6
+ from fshlink import FshLinkWrapper
7
+
8
+ fsh = FshLinkWrapper()
9
+
10
+ orig_link = fsh.get_url("ND8nulaEot") # will return a FshOriginalLink object
11
+ print(orig_link.url) # https://example.com
12
+
13
+ short_link = fsh.shorten_url("https://example.com") # will return a FshShortenedLink object
14
+ print(short_link.url) # https://link.fsh.plus/ND8nulaEot
15
+ ```
@@ -0,0 +1,34 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 77.0.3", "requests >= 2.30"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fshlink"
7
+ authors = [
8
+ { name = "maxie" }
9
+ ]
10
+ description = "FshLink API Wrapper written in Python"
11
+ readme = "README.md"
12
+ requires-python = ">=3.10"
13
+ dependencies = [
14
+ "requests >= 2.30"
15
+ ]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Operating System :: OS Independent"
24
+ ]
25
+ license = "MIT"
26
+ license-files = ["LICEN[CS]E*"]
27
+ dynamic = ["version"]
28
+
29
+ [project.urls]
30
+ Homepage = "https://codeberg.org/maxeepy/fshlink-wrapper"
31
+ Issues = "https://codeberg.org/maxeepy/fshlink-wrapper/issues"
32
+
33
+ [tool.setuptools.dynamic]
34
+ version = { attr = "fshlink.__version__" }
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .fshlink import *
2
+
3
+ __version__ = "1.0.0"
@@ -0,0 +1,42 @@
1
+ import requests
2
+
3
+ class FshOriginalLink:
4
+ def __init__(self, url: str):
5
+ self.url = url
6
+
7
+ def __str__(self):
8
+ return self.url
9
+
10
+ def __repr__(self):
11
+ url = self.url
12
+ return f"FshOriginalLink({url=})"
13
+
14
+ class FshShortenedLink:
15
+ def __init__(self, url: str, code: str = None):
16
+ self.url = url
17
+ self.code = code
18
+ if code is None:
19
+ self.code = url.split("/")[-1]
20
+
21
+ def __str__(self):
22
+ return self.url
23
+
24
+ def __repr__(self):
25
+ url = self.url
26
+ code = self.code
27
+ return f"FshShortenedLink({url=}, {code=})"
28
+
29
+ class FshLinkWrapper:
30
+ def __init__(self, base_url = "https://link.fsh.plus"):
31
+ self.base_url = base_url
32
+ self._session = requests.Session()
33
+
34
+ def get_url(self, code: str) -> FshOriginalLink:
35
+ url = f"{self.base_url}/get/{code}"
36
+ response = self._session.get(url)
37
+ return FshOriginalLink(response.json()["link"])
38
+
39
+ def shorten_url(self, url: str, time_seconds: int = 0, uses: int = 0) -> FshShortenedLink:
40
+ url = f"{self.base_url}/create"
41
+ response = self._session.post(url, params = {"time": time_seconds, "uses": uses})
42
+ return FshShortenedLink(response.json()["url"], url.split("/")[-1])
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: fshlink
3
+ Version: 1.0.0
4
+ Summary: FshLink API Wrapper written in Python
5
+ Author: maxie
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://codeberg.org/maxeepy/fshlink-wrapper
8
+ Project-URL: Issues, https://codeberg.org/maxeepy/fshlink-wrapper/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: requests>=2.30
20
+ Dynamic: license-file
21
+
22
+ # fshlink
23
+
24
+ a wrapper written in python for https://link.fsh.plus/
25
+
26
+ ```py
27
+ from fshlink import FshLinkWrapper
28
+
29
+ fsh = FshLinkWrapper()
30
+
31
+ orig_link = fsh.get_url("ND8nulaEot") # will return a FshOriginalLink object
32
+ print(orig_link.url) # https://example.com
33
+
34
+ short_link = fsh.shorten_url("https://example.com") # will return a FshShortenedLink object
35
+ print(short_link.url) # https://link.fsh.plus/ND8nulaEot
36
+ ```
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/fshlink/__init__.py
5
+ src/fshlink/fshlink.py
6
+ src/fshlink.egg-info/PKG-INFO
7
+ src/fshlink.egg-info/SOURCES.txt
8
+ src/fshlink.egg-info/dependency_links.txt
9
+ src/fshlink.egg-info/requires.txt
10
+ src/fshlink.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.30
@@ -0,0 +1 @@
1
+ fshlink