(20251114) Ready to start API testing.

This commit is contained in:
2025-11-14 18:20:54 +05:30
parent 6e19717e0b
commit 5ac5ad9ece
31 changed files with 32194 additions and 15 deletions
@@ -43,7 +43,7 @@ import io
import torch
from transformers import pipeline
# To download images from URLs:
# To downloads images from URLs:
import requests
# To read images:
@@ -43,7 +43,7 @@ import io
import torch
from transformers import pipeline
# To download images from URLs:
# To downloads images from URLs:
import requests
# To read images:
+3 -3
View File
@@ -1655,14 +1655,14 @@ class AsyncMongoStorage(AsyncMongo):
):
"""
Returns a GridOut object so that you can implement your own download logic using the built-in 'read' method.
Returns a GridOut object so that you can implement your own downloads logic using the built-in 'read' method.
Once the reading is done, use the 'close' method to release the resources used by the stream.
:param file_id: (RECOMMENDED) the id of the save file.
:param file_name: The name of the saved file. NOT RECOMMENDED because you could have many files with the same
name. The best way to tell files apart if from the id.
:param session: The session if you need to do this in a transaction.
:param raise_exception: Whether, or not, you want to raise an exception when something fails.
:return: The download stream that implements the 'read' and 'close' methods, or None if something failed.
:return: The downloads stream that implements the 'read' and 'close' methods, or None if something failed.
"""
# Ensure you are connected:
@@ -1671,7 +1671,7 @@ class AsyncMongoStorage(AsyncMongo):
# Assume failure:
stream = None
# Try to open a download stream:
# Try to open a downloads stream:
try:
# If a file id is supplied (preferred way):
@@ -242,7 +242,7 @@ class GmailMessage:
"""
Add a file as an attachment to the mail. This file, even if possible, will not be rendered on the screen in-line
with the body. It will be made available as a download.
with the body. It will be made available as a downloads.
:param attachment_file: The file that you would like to attach.
:param file_name: The name of the file. This is the same name by which it will be downloaded. You need not
specify this if the input file is specified as a path. Needed when you give the input file as a buffer.
+1 -1
View File
@@ -50,7 +50,7 @@ import numpy as np
# To run OCR:
import easyocr
# To download images from the web:
# To downloads images from the web:
import requests
# My utils:
+1 -1
View File
@@ -49,7 +49,7 @@ import numpy as np
# To run OCR:
import easyocr
# To download images from the web:
# To downloads images from the web:
import requests
# My utils:
+4 -4
View File
@@ -230,7 +230,7 @@ class PDFMaker:
"""
Download a file from a URL.
:param url: The URL to download the file from.
:param url: The URL to downloads the file from.
:param follow_redirects: Whether, or not, to follow along with any redirects when downloading the file.
:return: The downloaded file or None.
"""
@@ -458,7 +458,7 @@ class PDFMaker:
"""
Download a font from a URL and then register it for use.
:param name: The name you would later refer to the font by.
:param url: The URL to download the font from.
:param url: The URL to downloads the font from.
:param follow_redirects: Whether, or not, to follow along with any redirects when downloading the file.
:return: True if registered, else False.
"""
@@ -719,7 +719,7 @@ class PDFMaker:
"""
Asynchronously downloads an image and returns it as a PIL object.
Use this instead of just passing the URL to 'draw_image' for better efficiency.
:param url: [str] The URL to download the image from.
:param url: [str] The URL to downloads the image from.
:param follow_redirects: [bool] Whether, or not, to follow redirect URLs when downloading the file.
:param as_pil: [bool] If True, a PIL object will be returned, else a PNG file will be returned in RAM (BytesIO).
:param format: [str] The type of output file that you want. Not applicable for PIL objects.
@@ -1369,7 +1369,7 @@ class PDFMaker:
width = end_x - start_x
height = end_y - start_y
# In case the image is passed as a URL, we try to download it and open it as a PIL object:
# In case the image is passed as a URL, we try to downloads it and open it as a PIL object:
if isinstance(image, str):
if image.startswith("https://") or image.startswith("http://"):
image = Image.open(io.BytesIO(requests.get(image).content))
+1 -1
View File
@@ -405,7 +405,7 @@ class AsyncTelegramBot:
) -> TelegramApiResponse:
"""
To download a file from Telegram.
To downloads a file from Telegram.
NOTE: THIS DOES NOT WORK WHILE A WEBHOOK IS SET UP. YOU CAN EITHER USE THIS OR A WEBHOOK, NOT BOTH
SIMULTANEOUSLY.
:param file_id: The 'file_id' of this file. Not to be confused with 'file_unique_id'.