Sentry Python This function uses the Sentry library's Client and captureException methods to capture exceptions and log them to Sentry. Python Function 2024-12-16 12:16:52 15 views
PySerial This function randomly selects a serial port from the provided list and connects to it using the specified baudrate and timeout. If the port list is empty, it raises a ValueError exception. Function 2024-12-16 12:16:44 26 views
requests requests.auth This function fetches content from a specified URL using basic authentication. It takes a URL, username, and password as parameters, sends a request using the get method from the requests library, and performs authentication using HTTPBasicAuth. Web Request 2024-12-16 12:16:27 15 views
Celery Python This function is a Celery task that randomly selects two input arguments to perform mathematical operations and returns the result. If the task execution time exceeds the predefined time limit, it logs an error and returns None. The type of code 2024-12-16 12:16:10 22 views
Pathlib Set This function randomly selects a file extension from all files in the specified directory. It raises an exception if the directory is empty or not a directory. Function 2024-12-16 12:15:42 21 views
FastAPI random This function creates a FastAPI application that provides an endpoint to return a random user agent string. FastAPI Web Service 2024-12-16 12:15:11 8 views
urllib3 HTTP This function uses urllib3's PoolManager to create an HTTP connection pool and retrieves the content from the specified URL using a GET request. If the request times out or fails, the function catches the exception and returns None. Function 2024-12-16 12:14:56 8 views
pymysql This function uses the pymysql library to query the current database name connected to the MySQL database and prints it. If an error occurs during the query, it catches the exception and prints the error message. The type of code 2024-12-16 12:14:40 7 views
FastAPI Pydantic This function takes a dictionary containing item information, parses it into an `Item` model, and then calls the `create_item` function to create the item. If there is a validation error during parsing, it raises an HTTP exception. FastAPI custom function 2024-12-16 12:14:18 6 views
boto3 This function uses the boto3 library's S3 client to generate a random S3 bucket name that does not exist. It first generates a random suffix, then attempts to create a bucket with a combination of a given prefix and the suffix. If the bucket already exists, it will catch the exception and continue until it finds a bucket that does not exist. The type of code 2024-12-16 12:14:11 21 views