Skip to content

Commit 9c34a40

Browse files
committed
Add hosting: vgy
1 parent c392e79 commit 9c34a40

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ yay -S python-images-upload-cli
4949
| [up2sha](https://up2sha.re/) | + | `https://up2sha.re/media/raw/{id}.png` |
5050
| [uplio](https://upl.io/) | + | `https://upl.io/i/{id}.png` |
5151
| [uploadcare](https://uploadcare.com/) | + | `https://ucarecdn.com/{id}/img.png` |
52+
| [vgy](https://vgy.me/) | + | `https://i.vgy.me/{id}.png` |
5253

5354
## Usage
5455

@@ -58,7 +59,7 @@ Usage: images-upload-cli [OPTIONS] IMAGES...
5859
Upload images via APIs.
5960

6061
Options:
61-
-h, --hosting [catbox|fastpic|filecoffee|freeimage|gyazo|imageban|imgbb|imgchest|imgur|pictshare|pixeldrain|pixhost|ptpimg|screenshotting|smms|sxcu|telegraph|thumbsnap|up2sha|uplio|uploadcare|test]
62+
-h, --hosting [catbox|fastpic|filecoffee|freeimage|gyazo|imageban|imgbb|imgchest|imgur|pictshare|pixeldrain|pixhost|ptpimg|screenshotting|smms|sxcu|telegraph|thumbsnap|up2sha|uplio|uploadcare|vgy]
6263
[default: imgur]
6364
-b, --bbcode Add bbcode tags.
6465
-t, --thumbnail Add caption thumbnail and bbcode tags.
@@ -85,6 +86,7 @@ THUMBSNAP_KEY=
8586
UP2SHA_KEY=
8687
UPLIO_KEY=
8788
UPLOADCARE_KEY=
89+
VGY_KEY=
8890
```
8991

9092
You can set these in environment variables, or in `.env` file:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "images-upload-cli"
3-
version = "1.0.5"
3+
version = "1.0.6"
44
description = "Upload images via APIs"
55
authors = ["DeadNews <[email protected]>"]
66
license = "MIT"

src/images_upload_cli/upload.py

+16
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,21 @@ def uploadcare_upload(img: bytes) -> str:
318318
return f"https://ucarecdn.com/{response.json()['filename']}/{name}"
319319

320320

321+
def vgy_upload(img: bytes) -> str:
322+
key = get_env_val("VGY_KEY")
323+
name = f"img.{get_img_ext(img)}"
324+
325+
response = post(
326+
url="https://vgy.me/upload",
327+
data={"userkey": key},
328+
files={"file[]": (name, img)},
329+
)
330+
if not response.ok:
331+
raise UploadError(response.json())
332+
333+
return response.json()["image"]
334+
335+
321336
UPLOAD: dict[str, Callable[[bytes], str]] = {
322337
"catbox": catbox_upload,
323338
"fastpic": fastpic_upload,
@@ -340,6 +355,7 @@ def uploadcare_upload(img: bytes) -> str:
340355
"up2sha": up2sha_upload,
341356
"uplio": uplio_upload,
342357
"uploadcare": uploadcare_upload,
358+
"vgy": vgy_upload,
343359
}
344360

345361
HOSTINGS = tuple(UPLOAD.keys())

0 commit comments

Comments
 (0)