Python/utils/operate.py

62 lines
956 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
"""
脚本说明基于MySQL、MongoDB、Request和飞书等API封装成常用功能
备注:
后续需要考虑优化后续utils中脚本尽可能相互独立
"""
# 导入模块
import json
import pandas
import warnings
import numpy
from pydantic import BaseModel, ValidationError, AfterValidator, Field, HttpUrl
from typing import Optional, Union, Unpack, Literal, Dict, TypedDict, Annotated
from requests_toolbelt import MultipartEncoder
import cv2
from requests import Session, Response
from requests.adapters import HTTPAdapter
from urllib.parse import (
urlparse,
urlsplit,
urlunsplit,
parse_qs,
quote,
quote_plus,
unquote,
urlencode,
)
from urllib.request import Request as request, urlopen
from urllib.util.retry import Retry
from urllib.error import HTTPError
from pymongo import MongoClient
import os
import threading
import time
from functools import wraps