Skip to content

upload

Upload images to various hosting services.

anhmoe_upload async

anhmoe_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the anh.mo.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@logger.catch(default="")
async def anhmoe_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `anh.mo`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = "anh.moe_public_api"

    response = await client.post(
        url="https://anh.moe/api/1/upload",
        data={"key": key},
        files={"source": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["image"]["url"]

beeimg_upload async

beeimg_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the beeimg.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@logger.catch(default="")
async def beeimg_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `beeimg.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    ext = get_img_ext(img)
    name = f"img.{ext}"
    content_type = f"image/{ext}"

    response = await client.post(
        url="https://beeimg.com/api/upload/file/json/",
        files={"file": (name, img, content_type)},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return f"https:{response.json()['files']['url']}"

catbox_upload async

catbox_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the catbox.moe.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@logger.catch(default="")
async def catbox_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `catbox.moe`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    response = await client.post(
        url="https://catbox.moe/user/api.php",
        data={"reqtype": "fileupload"},
        files={"fileToUpload": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.text

fastpic_upload async

fastpic_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the fastpic.org.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
@logger.catch(default="")
async def fastpic_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `fastpic.org`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    response = await client.post(
        url="https://fastpic.org/upload?api=1",
        data={
            "method": "file",
            "check_thumb": "no",
            "uploading": "1",
        },
        files={"file1": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    match = search(r"<imagepath>(.+?)</imagepath>", response.text)
    if match is None:
        logger.error(f"Image link not found in '{response.url}' response.")
        logger.debug(f"Response text:\n{response.text}")
        return ""

    return match[1].strip()

filecoffee_upload async

filecoffee_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the file.coffee.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
@logger.catch(default="")
async def filecoffee_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `file.coffee`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    response = await client.post(
        url="https://file.coffee/api/file/upload",
        files={"file": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["url"]

freeimage_upload async

freeimage_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the freeimage.host.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
@logger.catch(default="")
async def freeimage_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `freeimage.host`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("FREEIMAGE_KEY")

    response = await client.post(
        url="https://freeimage.host/api/1/upload",
        data={"key": key},
        files={"source": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["image"]["url"]

gyazo_upload async

gyazo_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the gyazo.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
@logger.catch(default="")
async def gyazo_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `gyazo.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("GYAZO_TOKEN")

    response = await client.post(
        url=f"https://upload.gyazo.com/api/upload?access_token={key}",
        files={"imagedata": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["url"]

imageban_upload async

imageban_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the imageban.ru.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
@logger.catch(default="")
async def imageban_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `imageban.ru`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    token = get_env("IMAGEBAN_TOKEN")

    response = await client.post(
        url="https://api.imageban.ru/v1",
        headers={"Authorization": f"TOKEN {token}"},
        files={"image": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["data"]["link"]

imagebin_upload async

imagebin_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the imagebin.ca.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
@logger.catch(default="")
async def imagebin_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `imagebin.ca`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    response = await client.post(
        url="https://imagebin.ca/upload.php",
        files={"file": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    match = search(r"url:(.+?)$", response.text)
    if match is None:
        logger.error(f"Image link not found in '{response.url}' response.")
        logger.debug(f"Response text:\n{response.text}")
        return ""

    return match[1].strip()

imgbb_upload async

imgbb_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the imgbb.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
@logger.catch(default="")
async def imgbb_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `imgbb.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("IMGBB_KEY")

    response = await client.post(
        url="https://api.imgbb.com/1/upload",
        data={"key": key},
        files={"image": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["data"]["url"]

imgchest_upload async

imgchest_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the imgchest.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
@logger.catch(default="")
async def imgchest_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `imgchest.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("IMGCHEST_KEY")
    name = f"img.{get_img_ext(img)}"

    response = await client.post(
        url="https://api.imgchest.com/v1/post",
        headers={"Authorization": f"Bearer {key}"},
        files={"images[]": (name, img)},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["data"]["images"][0]["link"]

imgur_upload async

imgur_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the imgur.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
@logger.catch(default="")
async def imgur_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `imgur.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    client_id = getenv("IMGUR_CLIENT_ID", "dd32dd3c6aaa9a0")

    response = await client.post(
        url="https://api.imgur.com/3/image",
        headers={"Authorization": f"Client-ID {client_id}"},
        files={"image": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["data"]["link"]

lensdump_upload async

lensdump_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the lensdump.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
@logger.catch(default="")
async def lensdump_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `lensdump.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("LENSDUMP_KEY")

    response = await client.post(
        url="https://lensdump.com/api/1/upload",
        data={"key": key},
        files={"source": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["image"]["url"]

pixeldrain_upload async

pixeldrain_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the pixeldrain.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
@logger.catch(default="")
async def pixeldrain_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `pixeldrain.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("PIXELDRAIN_KEY")

    response = await client.post(
        url="https://pixeldrain.com/api/file",
        auth=BasicAuth(username="", password=key),
        files={"file": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return f"https://pixeldrain.com/api/file/{response.json()['id']}"

pixhost_upload async

pixhost_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the pixhost.to.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
@logger.catch(default="")
async def pixhost_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `pixhost.to`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    response = await client.post(
        url="https://api.pixhost.to/images",
        data={"content_type": 0},
        files={"img": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    show_url = response.json()["show_url"]

    # Get direct link.
    get_resp = await client.get(show_url)
    u = urlparse(show_url)
    match = search(
        rf"({u.scheme}://(.+?){u.netloc}/images/{u.path.removeprefix('/show/')})",
        get_resp.text,
    )
    image_link = None if match is None else match[0].strip()

    return show_url if image_link is None else image_link

ptpimg_upload async

ptpimg_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the ptpimg.me.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
@logger.catch(default="")
async def ptpimg_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `ptpimg.me`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("PTPIMG_KEY")

    response = await client.post(
        url="https://ptpimg.me/upload.php",
        data={"api_key": key},
        files={"file-upload[0]": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return f"https://ptpimg.me/{response.json()[0]['code']}.{response.json()[0]['ext']}"

smms_upload async

smms_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the sm.ms.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
@logger.catch(default="")
async def smms_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `sm.ms`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("SMMS_KEY")

    response = await client.post(
        url="https://sm.ms/api/v2/upload",
        headers={"Authorization": key},
        files={"smfile": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    json = response.json()

    return json["images"] if json["code"] == "image_repeated" else json["data"]["url"]

sxcu_upload async

sxcu_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the sxcu.net.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
@logger.catch(default="")
async def sxcu_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `sxcu.net`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    response = await client.post(
        url="https://sxcu.net/api/files/create",
        headers={"user-agent": "python-https/1.0.0"},
        files={"file": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return f"{response.json()['url']}.{get_img_ext(img)}"

telegraph_upload async

telegraph_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the telegra.ph.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
@logger.catch(default="")
async def telegraph_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `telegra.ph`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    response = await client.post(
        url="https://telegra.ph/upload",
        files={"file": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return f"https://telegra.ph{response.json()[0]['src']}"

thumbsnap_upload async

thumbsnap_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the thumbsnap.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
@logger.catch(default="")
async def thumbsnap_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `thumbsnap.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("THUMBSNAP_KEY")

    response = await client.post(
        url="https://thumbsnap.com/api/upload",
        data={"key": key},
        files={"media": img},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["data"]["media"]

tixte_upload async

tixte_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the tixte.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
@logger.catch(default="")
async def tixte_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `tixte.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("TIXTE_KEY")
    name = f"img.{get_img_ext(img)}"

    response = await client.post(
        url="https://api.tixte.com/v1/upload",
        headers={"Authorization": key},
        data={"payload_json": '{"random":true}'},
        files={"file": (name, img)},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["data"]["direct_url"]

up2sha_upload async

up2sha_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the up2sha.re.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
@logger.catch(default="")
async def up2sha_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `up2sha.re`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("UP2SHA_KEY")
    ext = get_img_ext(img)
    name = f"img.{ext}"

    response = await client.post(
        url="https://api.up2sha.re/files",
        headers={"X-Api-Key": key},
        files={"file": (name, img)},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return f"{response.json()['public_url'].replace('file?f=', 'media/raw/')}.{ext}"

uplio_upload async

uplio_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the upl.io.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
@logger.catch(default="")
async def uplio_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `upl.io`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("UPLIO_KEY")
    ext = get_img_ext(img)
    name = f"img.{ext}"

    response = await client.post(
        url="https://upl.io",
        data={"key": key},
        files={"file": (name, img)},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    host, uid = response.text.rsplit("/", 1)
    return f"{host}/i/{uid}.{ext}"

uploadcare_upload async

uploadcare_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the uploadcare.com.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
@logger.catch(default="")
async def uploadcare_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `uploadcare.com`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("UPLOADCARE_KEY")
    name = f"img.{get_img_ext(img)}"

    response = await client.post(
        url="https://upload.uploadcare.com/base/",
        data={
            "UPLOADCARE_PUB_KEY": key,
            "UPLOADCARE_STORE": "1",
        },
        files={"filename": (name, img)},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return f"https://ucarecdn.com/{response.json()['filename']}/{name}"

vgy_upload async

vgy_upload(client: AsyncClient, img: bytes) -> str

Uploads an image to the vgy.me.

Parameters:

Name Type Description Default
client AsyncClient

The async HTTP client used to make the API request.

required
img bytes

The image data to be uploaded.

required

Returns:

Type Description
str

The URL of the uploaded image, or an empty string if the upload failed.

Source code in src/images_upload_cli/upload.py
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
@logger.catch(default="")
async def vgy_upload(client: AsyncClient, img: bytes) -> str:
    """Uploads an image to the `vgy.me`.

    Args:
        client: The async HTTP client used to make the API request.
        img: The image data to be uploaded.

    Returns:
        The URL of the uploaded image, or an empty string if the upload failed.
    """
    key = get_env("VGY_KEY")
    name = f"img.{get_img_ext(img)}"

    response = await client.post(
        url="https://vgy.me/upload",
        data={"userkey": key},
        files={"file[]": (name, img)},
    )
    if response.is_error:
        log_on_error(response)
        return ""

    return response.json()["image"]