bagbag


Namebagbag JSON
Version 0.74.46 PyPI version JSON
download
home_pagehttps://github.com/darren2046/bagbag
SummaryAn all in one python library
upload_time2024-12-20 03:33:21
maintainerNone
docs_urlNone
authorDarren
requires_python>=3.9
licenseMIT
keywords base library
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bagbag

An all in one python library

# Install

```bash
pip3 install bagbag --upgrade
```

# Docker

```bash
docker run --rm --name bagbag -v /path/to/file/run.py:/app/run.py darren2046/bagbag:latest
docker run --rm --name bagbag -v /path/to/file/run.py:/app/run.py darren2046/bagbag-gui:latest # xvfb running so can use gui application such as chromedriver with selenium
docker run --rm --name bagbag -v /path/to/file/run.py:/app/run.py darren2046/bagbag-gui-debug:latest # HTTP Server serving vnc desktop runing on port 80
```

# Library

* Crypto

  * AES(key:str, mode:str="cfb")
    * Encrypt(raw:str) -> str
    * Decrypt(enc:str) -> str
* File(path:str)

  * Write(data:str)
  * Append(data:str)
* Lg 日志模块

  * Lg.SetLevel(level:日志级别:str)
  * Lg.SetFile(path:日志路径:str, size:文件大小,MB:int, during:日志保留时间,天:int, color:是否带ANSI颜色:bool=True, json:是否格式化为json:bool=False)
  * Lg.Debug(message:str)
  * Lg.Trace(message:str)
  * Lg.Info(message:str)
  * Lg.Warn(message:str)
  * Lg.Error(message:str)
* String(string:str) 一些字符串处理函数

  * HasChinese() -> bool 是否包含中文
  * Language() -> str 语言
  * Repr() -> str
  * SimplifiedChineseToTraditional() -> str
  * TraditionalChineseToSimplified() -> str
  * Ommit(length:int) -> str
  * Filter(chars:str="1234567890qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM") -> str
  * Len() -> int
  * IsIPAddress() -> bool
* Time 时间

  * Strftime(timestamp:float|int, format:str="%Y-%m-%d %H:%M:%S") -> str
  * Strptime(timestring:str, format:str=None) -> int
* Base64

  * Encode(s:str|bytes) -> str
  * Decode(s:str) -> str|bytes
* Json

  * Dumps(obj, indent=4, ensure_ascii=False) -> str
  * Loads(s:str) -> list | dict
  * ExtraValueByKey(obj:list|dict, key:str) -> list
* Hash

  * Md5sum(string:str) -> str
  * Md5sumFile(fpath:str, block_size=2**20) -> str
  * Sha256sum(data:str|bytes) -> str
  * Sha256sumFile(fpath:str, block_size=2**20) -> str
* Os

  * Exit(num:int=0)
  * Mkdir(path:str)
  * Getenv(varname:str, defaultValue:str=None) -> str | None
  * ListDir(path:str) -> list[str]
  * Unlink(path:str)
  * Move(src:str, dst:str, force:bool=True)
  * Copy(src:str, dst:str, force:bool=True)
  * Path
    * Basedir(path:str) -> str
    * Join(*path) -> str
    * Exists(path:str) -> bool
    * Uniquify(path:str) -> str
    * IsDir(path:str) -> bool
    * Basename(path:str) -> str
* Http

  * Head(url:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)
  * Get(url:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None,  TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)
  * PostRaw(url:str, Data:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)
  * PostJson(url:str, Json:dict,Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)
  * PostForm(url:str, Data:dict, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)
  * Delete(url:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)
  * PutForm(url:str, Data:dict,Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)
  * PutRaw(url:str, Data:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False, Debug:bool=False)
  * PutJson(url:str, Json:dict, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)
* Socket

  * TCP
    * Listen(host:str, port:int, waitQueue:int=5)
      * Accept() -> Chan[StreamConnection]
      * AcceptOne() -> StreamConnection
    * Connect(host:str, port:int) -> StreamConnection
      * PeerAddress() -> TCPPeerAddress
      * Send(data:str)
      * SendBytes(data:bytes)
      * Recv(length:int) -> str
      * RecvBytes(length:int) -> bytes
      * Close()
* Random

  * Int(min:int, max:int) -> int
  * Choice(obj:list|str) -> Any
  * String(length:int, charset:str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") -> str
  * Shuffle(li:list) -> list
* Funcs

  * Markdown2Html(text:str) -> str
  * Wget(url:str, dest:str=None, override=True)
  * IP2Int(ip:str) -> int
  * Int2IP(intip:int) -> str
  * ResizeImage(src:str, dst:str, width:int, quality:int=95)
  * UUID() -> str
  * CutSentence(sentence:str, filter:bool=True) -> list[str]
* Tools 一些工具

  * Cache

    * LRU(size:int) -> dict
    * FIFO(size:int) -> dict
    * LFU(size:int) -> dict
    * MRU(size:int) -> dict
    * RR(size:int) -> dict
    * TTL(size:int) -> dict
  * OCR(server:str)

    * Recognition(fpath:str, lang:str="ch") -> ocrResult
      * SaveImage(fpath:str)
  * WebCrawler()

    * Run(self, url:str) -> typing.Iterable[WebCrawlerResult]
  * JavaScript

    * Eval(code:str)
  * BlockChain

    * Tron
      * TronClient(fullNodeServer:str)
        * Block(blockNumber:int) -> tronBlock
          * Transcations() -> list[tronTranscation]
      * TronContract(address:str)
        * Info()
        * Address()
      * TronAsset(name:str)
        * Info()
        * Name()
    * Binance
      * OfficalAccountVertify
        * Twitter(account:str, waiteOnRateLimit:bool=True) -> bool
      * GetPrice(pair:str|list=None) -> CoinsPairPrice | list[CoinsPairPrice]
  * Twitter

    * Essential(bearerToken:str)
      * Search(keyword:str, sinceID:int=None, tweetPerRequest:int=10) -> typing.Iterable[twitterTweet]
      * Timeline(screename:str, sinceID:int=None, tweetPerRequest:int=10) -> typing.Iterable[twitterTweet]
    * Elevated(consumer_key:str, consumer_secret:str)
      * Search(keyword:str, days:int=7) -> typing.Iterable[twitterTweet]
      * Timeline(screename:str) -> typing.Iterable[twitterTweet]
      * Followers(screename:str) -> typing.Iterable[twitterUser]
  * Nslookup(server:list[str]=["8.8.8.8", "1.1.1.1", "8.8.4.4"], tcp:bool=False)

    * A(domain:str) -> list[str]
    * AAAA(domain:str) -> list[str]
  * MatrixBot(apiserver:str, password:str="")

    * SetRoom(room:str) -> MatrixBot
    * Send(message:str)
    * SendImage(path:str)
    * GetMessage(num:int=10) -> list[MatrixBotMessage]
      * Reply(message:str)
      * ReplyImage(path:str)
  * RSS

    * Opml(opmlurl:str) -> list[RSSFeed]
    * Feed(feedurl:str) -> list[RSSPage]
  * Queue(server:str, name:str, length:int=0, timeout:int=300)

    * QueueConfirm(name:str, length:int=0, timeout:int=300) -> queueQueueConfirm
      * Put(item:typing.Any, force:bool=False)
      * Get(self) -> typing.Tuple[str, typing.Any]
      * Done(tid:str)
      * Size(self) -> int
  * Kafka(topic:str, servers:str|list)

    * Producer(value_serializer=lambda m: json.dumps(m).encode()) -> KafkaProducer
      * Send(data:dict)
    * Consumer(group_id:str=None, auto_offset_reset:str='earliest') -> KafkaConsumer
      * Get() -> dict
  * Github(token:str, ratelimit:str="30/m")

    * Search(pattern:str) -> GithubSearchResults
      * Get() -> GithubSearchResult | None
  * SSH(host:str, port:int=None, user:str=None, password:str=None, pkey:str=None)

    * GetOutput(command:str) -> str
    * Close()
    * Upload(localpath:str, remotepath:str=None)
    * Download(remotepath:str, localpath:str=None)
    * FileInfo(filepath:str)
    * ListDir(dirpath:str=".") -> dict
  * Translater

    * Baidu(appid:str, secretkey:str)
      * SetLang(To:str="zh", From:str="auto") -> Baidu
      * Translate(text:str) -> dict
    * Google(httpProxy:str=None)
      * SetLang(To:str="zh-CN", From:str="auto") -> Google
      * Translate(text:str, format:str="html") -> str
  * XPath(html:str)

    * Find(xpath:str) -> XPath | None
    * Attribute(name:str) -> str | None
    * Text() -> str
    * Html() -> str
  * WaitGroup()

    * Add()
    * Done()
    * Wait()
  * Crontab()

    * Every(interval: int = 1) -> Crontab
    * Second() -> Crontab
    * Minute() -> Crontab
    * Hour() -> Crontab
    * Day() -> Crontab
    * Week() -> Crontab
    * At(time: str) -> Crontab
    * Do(job_func, *args, **kwargs)
    * Monday()
    * Tuesday()
    * Wednesday()
    * Thursday()
    * Friday()
    * Saturday()
    * Sunday()
  * Elasticsearch(url:str)

    * Delete(IndexName:str)
    * Collection(IndexName:str)
      * Index(id:int, data:dict, refresh:bool=False, Timeout:int=15)
      * Refresh(Timeout:int=15)
      * Delete(id:int)
      * Search(key:str, value:str, page:int=1, pagesize:int=50, OrderByKey:str=None, OrderByOrder:str="ase", Highlight:str=None, mustIncludeAllWords:bool=True)
  * CSV

    * Reader(fpath:str)
      * Read() -> dict
      * Close()
    * Writer(fpath:str, mode:str="w")
      * SetHeaders(*headers)
      * Write(row:dict[str])
      * Close()
      * Flush()
  * Xlsx

    * Reader(fpath:str)
      * Read() -> dict
      * Close()
    * Writer(fpath:str, mode:str="w")
      * SetHeaders(*headers)
      * Write(row:dict[str])
      * Close()
      * Flush()
  * WebServer(name:str=None) # 例子见源码文件Web.py的后半部分

    * Run(host:str, port:int, block:bool=True) # 监听HTTP服务
    * Route: (path:str, methods:list=["GET", "HEAD", "OPTIONS"]) # 例子见Web.py文件, 是一个装饰器
    * Request()
      * Method() -> str # 请求的HTTP方法
      * Json() -> dict | list # 格式化请求的post内容为json
      * Data() -> str # post的http的body
      * Form()
        * Get(name:str, default:str="") -> str | None # 获取表单的数据
      * Args()
        * Get(name:str, default:str="") -> str | None # 获取URL的参数
  * Chan() 内存队列, 跟go的chan一样
  * RateLimit(rate:str, sleep:bool=True) rate可以是 次数/时间区间, 时间可以是s, m, h, d, 即秒,分,时,天. 例如一分钟限制五次: 5/m. 在低速率的时候能限制准确, 例如低于1秒10次. 高速率例如每秒50次以上, 实际速率会降低, 速率越高降低越多.

    * Take() sleep=True的时候会添加一个sleep, 可以把请求平均在时间段内. 在低速率的时候能限制准确. 高速率例如每秒50次以上, 实际速率会降低, 速率越高降低越多. sleep=False的时候没有sleep, 会全在一开始扔出去, 然后block住, 等下一个周期, 在需要速率很高的时候可以这样, 例如发包的时候, 一秒限制2000个包这样.
  * URL(url:str)

    * Parse() -> URLParseResult
    * Encode() -> str
    * Decode() -> str
  * Prometheus

    * MetricServer(listen:str="0.0.0.0", port:int=9105)
    * PushGateway(address:str, job:str, pushinterval:int=15, instance:str=None)
      * NewCounter(name:str, help:str) -> prometheusCounter
        * Add(num:int|float=1)
      * NewCounterWithLabel(name:str, labels:list[str], help:str) -> prometheusCounterVec
        * Add(labels:dict|list, num:int|float=1)
      * NewGauge(name:str, help:str) -> prometheusGauge
        * Set(num:int|float)
      * NewGaugeWithLabel(name:str, labels:list[str], help:str) -> prometheusGaugeVec
        * Set(labels:dict|list, num:int|float=1)
  * Selenium

    * Firefox(seleniumServer:str=None, PACFileURL:str=None, sessionID:str=None)
    * Chrome(seleniumServer:str=None, httpProxy:str=None, sessionID=None)
      * Except(*xpath:str, timeout:int=30) -> int | None
      * ResizeWindow(width:int, height:int)
      * ScrollRight(pixel:int)
      * ScrollLeft(pixel:int)
      * ScrollUp(pixel:int)
      * ScrollDown(pixel:int)
      * Url() -> str
      * Cookie() -> list[dict]
      * SetCookie(cookie_dict:dict)
      * Refresh()
      * GetSession() -> str
      * Get(url:str)
      * PageSource() -> str
      * Title() -> str
      * Close()
      * SwitchTabByID(number:int)
      * SwitchTabByIdent(ident:str)
      * Tabs() -> list[str]
      * NewTab() -> str
      * Find(xpath:str, timeout:int=60, scrollIntoElement:bool=True) -> SeleniumElement
        * Clear() -> SeleniumElement
        * Click() -> SeleniumElement
        * Text() -> str
        * Attribute(name:str) -> str
        * Input(string:str) -> SeleniumElement
        * Submit() -> SeleniumElement
        * PressEnter() -> SeleniumElement
        * ScrollIntoElement() -> SeleniumElement
  * Telegram(appid:str, apphash:str, sessionString:str=None)

    * SessionString() -> str
    * ResolvePeerByUsername(username:str) -> TelegramPeer | None
    * PeerByIDAndHash(ID:int, Hash:int, Type:str="channel") -> TelegramPeer | None
      * Resolve() # 如果手动根据ID初始化一个TelegramPeer实例, 调用这个函数可以补全这个ID对应的Peer的信息
      * SendMessage(message:str)
      * Messages(limit:int=100, offset:int=0) -> list[TelegramMessage]
      * Message(id:str) -> TelegramMessage
        * Refresh() -> TelegramMessage # 有时候同一个id, 被编辑了, 刷新一下返回最新的消息
        * ClickButton(buttonText:str) -> bool
        * Delete()
  * TelegramBotOfficial(token:str)

    * GetMe() -> telebot.types.User
    * SetChatID(chatid:int) -> TelegramBot
    * SetTags(*tags:str) -> TelegramBot
    * SendFile(path:str)
    * SendImage(path:str)
    * SendVideo(path:str)
    * SendAudio(path:str)
    * SendLocation(latitude:float, longitude:float)
    * SendMsg(msg:str, *tags:str)
  * ProgressBar(iterable_obj, total=None, title=None, leave=False)
  * Redis(host: str, port: int = 6379, database: int = 0, password: str = "")

    * Set(key:str, value:str, ttl:int=None) -> (bool | None)
    * Get(key:str) -> (str | None)
    * Del(key:str) -> int
    * Lock(key:str) -> RedisLock
      * Acquire()
      * Release()
    * Queue(key:str) -> RedisQueue
      * Size() -> int
      * Put(item:str)
      * Get(block=True, timeout=None) -> str
  * MySQL(host: str, port: int, user: str, password: str, database: str, prefix:str = "") # 跟5.7兼容. 因为orator跟5.7兼容, 跟8.0会有小问题, 作者很久不更新, 有空换掉这个orm. **注意, Python的MySQL操作不支持多线程, 需要每个线程连接一次MySQL, 不过这个是自动的, 在Get, Update等操作的时候如果链接异常就重连**
  * SQLite(path: str, prefix:str = "") **由于SQLite每次只能一个线程进行操作, 所以这里默认会有一个锁, 线程安全**

    * Queue(tbname:str, size:int=None) -> NamedQueue
      * Size() -> int
      * Get(wait=True) -> Any
      * Put(string:Any)
    * QueueConfirm(tbname:str, size:int=None, timeout:int=900) -> NamedConfirmQueue
      * Size() -> int
      * SizeStarted() -> int
      * SizeTotal() -> int
      * Get(wait=True) -> typing.Tuple[int, typing.Any]
      * Put(item:typing.Any)
      * Done(id:int)
    * Execute(sql: str) -> (bool | int | list)
    * Tables() -> list
    * Table(tbname: str) -> MySQLSQLiteTable
      * AddColumn(colname: str, coltype: str, default=None, nullable:bool = True) -> MySQLSQLiteTable
      * AddIndex(*cols: str) -> MySQLSQLiteTable
      * Fields(*cols: str) -> MySQLSQLiteTable
      * Where(key:str, opera:str, value:str) -> MySQLSQLiteTable
      * WhereIn(key:str, value: list) -> MySQLSQLiteTable
      * WhereNotIn(key:str, value: list) -> MySQLSQLiteTable
      * WhereNull(key:str) -> MySQLSQLiteTable
      * WhereNotNull(key:str) -> MySQLSQLiteTable
      * WhereBetween(key:str, start:int|float|str, end:int|float|str) -> MySQLSQLiteTable
      * WhereNotBetween(key:str, start:int|float|str, end:int|float|str) -> MySQLSQLiteTable
      * OrWhere(key:str, opera:str, value:str) -> MySQLSQLiteTable
      * OrWhereIn(key:str, value: list) -> MySQLSQLiteTable
      * OrderBy(*key:str) -> MySQLSQLiteTable
      * Limit(num:int) -> MySQLSQLiteTable
      * Paginate(size:int, page:int) -> MySQLSQLiteTable
      * Data(value:map) -> MySQLSQLiteTable
      * Offset(num:int) -> MySQLSQLiteTable
      * Insert()
      * Update()
      * Delete()
      * InsertGetID() -> int
      * Exists() -> bool
      * Count() -> int
      * Find(id:int) -> map
      * First() -> map
      * Get() -> list
      * Columns() -> list[map]
    * KeyValue(tbname:str)
      * Get(key:str) -> Any
      * Set(key:str, value:Any)
      * Del(key:str)
      * Keys() -> list[str]

其它的

* Thread(func, *args:Any, daemon:bool=True) -> threading.Thread # 启动线程, daemon=True
* Process(func, *args:Any, daemon:bool=True) -> multiprocessing.Process # 启动进程, daemon=True


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/darren2046/bagbag",
    "name": "bagbag",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "base, library",
    "author": "Darren",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/15/cd/a473e3b70fbe5aa189c4dabbfeee77f47d6671db73e4426f01f1449aeb29/bagbag-0.74.46.tar.gz",
    "platform": null,
    "description": "# bagbag\n\nAn all in one python library\n\n# Install\n\n```bash\npip3 install bagbag --upgrade\n```\n\n# Docker\n\n```bash\ndocker run --rm --name bagbag -v /path/to/file/run.py:/app/run.py darren2046/bagbag:latest\ndocker run --rm --name bagbag -v /path/to/file/run.py:/app/run.py darren2046/bagbag-gui:latest # xvfb running so can use gui application such as chromedriver with selenium\ndocker run --rm --name bagbag -v /path/to/file/run.py:/app/run.py darren2046/bagbag-gui-debug:latest # HTTP Server serving vnc desktop runing on port 80\n```\n\n# Library\n\n* Crypto\n\n  * AES(key:str, mode:str=\"cfb\")\n    * Encrypt(raw:str) -> str\n    * Decrypt(enc:str) -> str\n* File(path:str)\n\n  * Write(data:str)\n  * Append(data:str)\n* Lg \u65e5\u5fd7\u6a21\u5757\n\n  * Lg.SetLevel(level:\u65e5\u5fd7\u7ea7\u522b:str)\n  * Lg.SetFile(path:\u65e5\u5fd7\u8def\u5f84:str, size:\u6587\u4ef6\u5927\u5c0f\uff0cMB:int, during:\u65e5\u5fd7\u4fdd\u7559\u65f6\u95f4\uff0c\u5929:int, color:\u662f\u5426\u5e26ANSI\u989c\u8272:bool=True, json:\u662f\u5426\u683c\u5f0f\u5316\u4e3ajson:bool=False)\n  * Lg.Debug(message:str)\n  * Lg.Trace(message:str)\n  * Lg.Info(message:str)\n  * Lg.Warn(message:str)\n  * Lg.Error(message:str)\n* String(string:str) \u4e00\u4e9b\u5b57\u7b26\u4e32\u5904\u7406\u51fd\u6570\n\n  * HasChinese() -> bool \u662f\u5426\u5305\u542b\u4e2d\u6587\n  * Language() -> str \u8bed\u8a00\n  * Repr() -> str\n  * SimplifiedChineseToTraditional() -> str\n  * TraditionalChineseToSimplified() -> str\n  * Ommit(length:int) -> str\n  * Filter(chars:str=\"1234567890qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM\") -> str\n  * Len() -> int\n  * IsIPAddress() -> bool\n* Time \u65f6\u95f4\n\n  * Strftime(timestamp:float|int, format:str=\"%Y-%m-%d %H:%M:%S\") -> str\n  * Strptime(timestring:str, format:str=None) -> int\n* Base64\n\n  * Encode(s:str|bytes) -> str\n  * Decode(s:str) -> str|bytes\n* Json\n\n  * Dumps(obj, indent=4, ensure_ascii=False) -> str\n  * Loads(s:str) -> list | dict\n  * ExtraValueByKey(obj:list|dict, key:str) -> list\n* Hash\n\n  * Md5sum(string:str) -> str\n  * Md5sumFile(fpath:str, block_size=2**20) -> str\n  * Sha256sum(data:str|bytes) -> str\n  * Sha256sumFile(fpath:str, block_size=2**20) -> str\n* Os\n\n  * Exit(num:int=0)\n  * Mkdir(path:str)\n  * Getenv(varname:str, defaultValue:str=None) -> str | None\n  * ListDir(path:str) -> list[str]\n  * Unlink(path:str)\n  * Move(src:str, dst:str, force:bool=True)\n  * Copy(src:str, dst:str, force:bool=True)\n  * Path\n    * Basedir(path:str) -> str\n    * Join(*path) -> str\n    * Exists(path:str) -> bool\n    * Uniquify(path:str) -> str\n    * IsDir(path:str) -> bool\n    * Basename(path:str) -> str\n* Http\n\n  * Head(url:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)\n  * Get(url:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None,  TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)\n  * PostRaw(url:str, Data:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)\n  * PostJson(url:str, Json:dict,Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)\n  * PostForm(url:str, Data:dict, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)\n  * Delete(url:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)\n  * PutForm(url:str, Data:dict,Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)\n  * PutRaw(url:str, Data:str, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False, Debug:bool=False)\n  * PutJson(url:str, Json:dict, Timeout:str=None, ReadBodySize:int=None, FollowRedirect:bool=True, HttpProxy:str=None, TimeoutRetryTimes:int=0, InsecureSkipVerify:int=False,Debug:bool=False)\n* Socket\n\n  * TCP\n    * Listen(host:str, port:int, waitQueue:int=5)\n      * Accept() -> Chan[StreamConnection]\n      * AcceptOne() -> StreamConnection\n    * Connect(host:str, port:int) -> StreamConnection\n      * PeerAddress() -> TCPPeerAddress\n      * Send(data:str)\n      * SendBytes(data:bytes)\n      * Recv(length:int) -> str\n      * RecvBytes(length:int) -> bytes\n      * Close()\n* Random\n\n  * Int(min:int, max:int) -> int\n  * Choice(obj:list|str) -> Any\n  * String(length:int, charset:str=\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\") -> str\n  * Shuffle(li:list) -> list\n* Funcs\n\n  * Markdown2Html(text:str) -> str\n  * Wget(url:str, dest:str=None, override=True)\n  * IP2Int(ip:str) -> int\n  * Int2IP(intip:int) -> str\n  * ResizeImage(src:str, dst:str, width:int, quality:int=95)\n  * UUID() -> str\n  * CutSentence(sentence:str, filter:bool=True) -> list[str]\n* Tools \u4e00\u4e9b\u5de5\u5177\n\n  * Cache\n\n    * LRU(size:int) -> dict\n    * FIFO(size:int) -> dict\n    * LFU(size:int) -> dict\n    * MRU(size:int) -> dict\n    * RR(size:int) -> dict\n    * TTL(size:int) -> dict\n  * OCR(server:str)\n\n    * Recognition(fpath:str, lang:str=\"ch\") -> ocrResult\n      * SaveImage(fpath:str)\n  * WebCrawler()\n\n    * Run(self, url:str) -> typing.Iterable[WebCrawlerResult]\n  * JavaScript\n\n    * Eval(code:str)\n  * BlockChain\n\n    * Tron\n      * TronClient(fullNodeServer:str)\n        * Block(blockNumber:int) -> tronBlock\n          * Transcations() -> list[tronTranscation]\n      * TronContract(address:str)\n        * Info()\n        * Address()\n      * TronAsset(name:str)\n        * Info()\n        * Name()\n    * Binance\n      * OfficalAccountVertify\n        * Twitter(account:str, waiteOnRateLimit:bool=True) -> bool\n      * GetPrice(pair:str|list=None) -> CoinsPairPrice | list[CoinsPairPrice]\n  * Twitter\n\n    * Essential(bearerToken:str)\n      * Search(keyword:str, sinceID:int=None, tweetPerRequest:int=10) -> typing.Iterable[twitterTweet]\n      * Timeline(screename:str, sinceID:int=None, tweetPerRequest:int=10) -> typing.Iterable[twitterTweet]\n    * Elevated(consumer_key:str, consumer_secret:str)\n      * Search(keyword:str, days:int=7) -> typing.Iterable[twitterTweet]\n      * Timeline(screename:str) -> typing.Iterable[twitterTweet]\n      * Followers(screename:str) -> typing.Iterable[twitterUser]\n  * Nslookup(server:list[str]=[\"8.8.8.8\", \"1.1.1.1\", \"8.8.4.4\"], tcp:bool=False)\n\n    * A(domain:str) -> list[str]\n    * AAAA(domain:str) -> list[str]\n  * MatrixBot(apiserver:str, password:str=\"\")\n\n    * SetRoom(room:str) -> MatrixBot\n    * Send(message:str)\n    * SendImage(path:str)\n    * GetMessage(num:int=10) -> list[MatrixBotMessage]\n      * Reply(message:str)\n      * ReplyImage(path:str)\n  * RSS\n\n    * Opml(opmlurl:str) -> list[RSSFeed]\n    * Feed(feedurl:str) -> list[RSSPage]\n  * Queue(server:str, name:str, length:int=0, timeout:int=300)\n\n    * QueueConfirm(name:str, length:int=0, timeout:int=300) -> queueQueueConfirm\n      * Put(item:typing.Any, force:bool=False)\n      * Get(self) -> typing.Tuple[str, typing.Any]\n      * Done(tid:str)\n      * Size(self) -> int\n  * Kafka(topic:str, servers:str|list)\n\n    * Producer(value_serializer=lambda m: json.dumps(m).encode()) -> KafkaProducer\n      * Send(data:dict)\n    * Consumer(group_id:str=None, auto_offset_reset:str='earliest') -> KafkaConsumer\n      * Get() -> dict\n  * Github(token:str, ratelimit:str=\"30/m\")\n\n    * Search(pattern:str) -> GithubSearchResults\n      * Get() -> GithubSearchResult | None\n  * SSH(host:str, port:int=None, user:str=None, password:str=None, pkey:str=None)\n\n    * GetOutput(command:str) -> str\n    * Close()\n    * Upload(localpath:str, remotepath:str=None)\n    * Download(remotepath:str, localpath:str=None)\n    * FileInfo(filepath:str)\n    * ListDir(dirpath:str=\".\") -> dict\n  * Translater\n\n    * Baidu(appid:str, secretkey:str)\n      * SetLang(To:str=\"zh\", From:str=\"auto\") -> Baidu\n      * Translate(text:str) -> dict\n    * Google(httpProxy:str=None)\n      * SetLang(To:str=\"zh-CN\", From:str=\"auto\") -> Google\n      * Translate(text:str, format:str=\"html\") -> str\n  * XPath(html:str)\n\n    * Find(xpath:str) -> XPath | None\n    * Attribute(name:str) -> str | None\n    * Text() -> str\n    * Html() -> str\n  * WaitGroup()\n\n    * Add()\n    * Done()\n    * Wait()\n  * Crontab()\n\n    * Every(interval: int = 1) -> Crontab\n    * Second() -> Crontab\n    * Minute() -> Crontab\n    * Hour() -> Crontab\n    * Day() -> Crontab\n    * Week() -> Crontab\n    * At(time: str) -> Crontab\n    * Do(job_func, *args, **kwargs)\n    * Monday()\n    * Tuesday()\n    * Wednesday()\n    * Thursday()\n    * Friday()\n    * Saturday()\n    * Sunday()\n  * Elasticsearch(url:str)\n\n    * Delete(IndexName:str)\n    * Collection(IndexName:str)\n      * Index(id:int, data:dict, refresh:bool=False, Timeout:int=15)\n      * Refresh(Timeout:int=15)\n      * Delete(id:int)\n      * Search(key:str, value:str, page:int=1, pagesize:int=50, OrderByKey:str=None, OrderByOrder:str=\"ase\", Highlight:str=None, mustIncludeAllWords:bool=True)\n  * CSV\n\n    * Reader(fpath:str)\n      * Read() -> dict\n      * Close()\n    * Writer(fpath:str, mode:str=\"w\")\n      * SetHeaders(*headers)\n      * Write(row:dict[str])\n      * Close()\n      * Flush()\n  * Xlsx\n\n    * Reader(fpath:str)\n      * Read() -> dict\n      * Close()\n    * Writer(fpath:str, mode:str=\"w\")\n      * SetHeaders(*headers)\n      * Write(row:dict[str])\n      * Close()\n      * Flush()\n  * WebServer(name:str=None) # \u4f8b\u5b50\u89c1\u6e90\u7801\u6587\u4ef6Web.py\u7684\u540e\u534a\u90e8\u5206\n\n    * Run(host:str, port:int, block:bool=True) # \u76d1\u542cHTTP\u670d\u52a1\n    * Route: (path:str, methods:list=[\"GET\", \"HEAD\", \"OPTIONS\"]) # \u4f8b\u5b50\u89c1Web.py\u6587\u4ef6, \u662f\u4e00\u4e2a\u88c5\u9970\u5668\n    * Request()\n      * Method() -> str # \u8bf7\u6c42\u7684HTTP\u65b9\u6cd5\n      * Json() -> dict | list # \u683c\u5f0f\u5316\u8bf7\u6c42\u7684post\u5185\u5bb9\u4e3ajson\n      * Data() -> str # post\u7684http\u7684body\n      * Form()\n        * Get(name:str, default:str=\"\") -> str | None # \u83b7\u53d6\u8868\u5355\u7684\u6570\u636e\n      * Args()\n        * Get(name:str, default:str=\"\") -> str | None # \u83b7\u53d6URL\u7684\u53c2\u6570\n  * Chan() \u5185\u5b58\u961f\u5217, \u8ddfgo\u7684chan\u4e00\u6837\n  * RateLimit(rate:str, sleep:bool=True) rate\u53ef\u4ee5\u662f \u6b21\u6570/\u65f6\u95f4\u533a\u95f4, \u65f6\u95f4\u53ef\u4ee5\u662fs, m, h, d, \u5373\u79d2,\u5206,\u65f6,\u5929. \u4f8b\u5982\u4e00\u5206\u949f\u9650\u5236\u4e94\u6b21: 5/m. \u5728\u4f4e\u901f\u7387\u7684\u65f6\u5019\u80fd\u9650\u5236\u51c6\u786e, \u4f8b\u5982\u4f4e\u4e8e1\u79d210\u6b21. \u9ad8\u901f\u7387\u4f8b\u5982\u6bcf\u79d250\u6b21\u4ee5\u4e0a, \u5b9e\u9645\u901f\u7387\u4f1a\u964d\u4f4e, \u901f\u7387\u8d8a\u9ad8\u964d\u4f4e\u8d8a\u591a.\n\n    * Take() sleep=True\u7684\u65f6\u5019\u4f1a\u6dfb\u52a0\u4e00\u4e2asleep, \u53ef\u4ee5\u628a\u8bf7\u6c42\u5e73\u5747\u5728\u65f6\u95f4\u6bb5\u5185. \u5728\u4f4e\u901f\u7387\u7684\u65f6\u5019\u80fd\u9650\u5236\u51c6\u786e. \u9ad8\u901f\u7387\u4f8b\u5982\u6bcf\u79d250\u6b21\u4ee5\u4e0a, \u5b9e\u9645\u901f\u7387\u4f1a\u964d\u4f4e, \u901f\u7387\u8d8a\u9ad8\u964d\u4f4e\u8d8a\u591a. sleep=False\u7684\u65f6\u5019\u6ca1\u6709sleep, \u4f1a\u5168\u5728\u4e00\u5f00\u59cb\u6254\u51fa\u53bb, \u7136\u540eblock\u4f4f, \u7b49\u4e0b\u4e00\u4e2a\u5468\u671f, \u5728\u9700\u8981\u901f\u7387\u5f88\u9ad8\u7684\u65f6\u5019\u53ef\u4ee5\u8fd9\u6837, \u4f8b\u5982\u53d1\u5305\u7684\u65f6\u5019, \u4e00\u79d2\u9650\u52362000\u4e2a\u5305\u8fd9\u6837.\n  * URL(url:str)\n\n    * Parse() -> URLParseResult\n    * Encode() -> str\n    * Decode() -> str\n  * Prometheus\n\n    * MetricServer(listen:str=\"0.0.0.0\", port:int=9105)\n    * PushGateway(address:str, job:str, pushinterval:int=15, instance:str=None)\n      * NewCounter(name:str, help:str) -> prometheusCounter\n        * Add(num:int|float=1)\n      * NewCounterWithLabel(name:str, labels:list[str], help:str) -> prometheusCounterVec\n        * Add(labels:dict|list, num:int|float=1)\n      * NewGauge(name:str, help:str) -> prometheusGauge\n        * Set(num:int|float)\n      * NewGaugeWithLabel(name:str, labels:list[str], help:str) -> prometheusGaugeVec\n        * Set(labels:dict|list, num:int|float=1)\n  * Selenium\n\n    * Firefox(seleniumServer:str=None, PACFileURL:str=None, sessionID:str=None)\n    * Chrome(seleniumServer:str=None, httpProxy:str=None, sessionID=None)\n      * Except(*xpath:str, timeout:int=30) -> int | None\n      * ResizeWindow(width:int, height:int)\n      * ScrollRight(pixel:int)\n      * ScrollLeft(pixel:int)\n      * ScrollUp(pixel:int)\n      * ScrollDown(pixel:int)\n      * Url() -> str\n      * Cookie() -> list[dict]\n      * SetCookie(cookie_dict:dict)\n      * Refresh()\n      * GetSession() -> str\n      * Get(url:str)\n      * PageSource() -> str\n      * Title() -> str\n      * Close()\n      * SwitchTabByID(number:int)\n      * SwitchTabByIdent(ident:str)\n      * Tabs() -> list[str]\n      * NewTab() -> str\n      * Find(xpath:str, timeout:int=60, scrollIntoElement:bool=True) -> SeleniumElement\n        * Clear() -> SeleniumElement\n        * Click() -> SeleniumElement\n        * Text() -> str\n        * Attribute(name:str) -> str\n        * Input(string:str) -> SeleniumElement\n        * Submit() -> SeleniumElement\n        * PressEnter() -> SeleniumElement\n        * ScrollIntoElement() -> SeleniumElement\n  * Telegram(appid:str, apphash:str, sessionString:str=None)\n\n    * SessionString() -> str\n    * ResolvePeerByUsername(username:str) -> TelegramPeer | None\n    * PeerByIDAndHash(ID:int, Hash:int, Type:str=\"channel\") -> TelegramPeer | None\n      * Resolve() # \u5982\u679c\u624b\u52a8\u6839\u636eID\u521d\u59cb\u5316\u4e00\u4e2aTelegramPeer\u5b9e\u4f8b, \u8c03\u7528\u8fd9\u4e2a\u51fd\u6570\u53ef\u4ee5\u8865\u5168\u8fd9\u4e2aID\u5bf9\u5e94\u7684Peer\u7684\u4fe1\u606f\n      * SendMessage(message:str)\n      * Messages(limit:int=100, offset:int=0) -> list[TelegramMessage]\n      * Message(id:str) -> TelegramMessage\n        * Refresh() -> TelegramMessage # \u6709\u65f6\u5019\u540c\u4e00\u4e2aid, \u88ab\u7f16\u8f91\u4e86, \u5237\u65b0\u4e00\u4e0b\u8fd4\u56de\u6700\u65b0\u7684\u6d88\u606f\n        * ClickButton(buttonText:str) -> bool\n        * Delete()\n  * TelegramBotOfficial(token:str)\n\n    * GetMe() -> telebot.types.User\n    * SetChatID(chatid:int) -> TelegramBot\n    * SetTags(*tags:str) -> TelegramBot\n    * SendFile(path:str)\n    * SendImage(path:str)\n    * SendVideo(path:str)\n    * SendAudio(path:str)\n    * SendLocation(latitude:float, longitude:float)\n    * SendMsg(msg:str, *tags:str)\n  * ProgressBar(iterable_obj, total=None, title=None, leave=False)\n  * Redis(host: str, port: int = 6379, database: int = 0, password: str = \"\")\n\n    * Set(key:str, value:str, ttl:int=None) -> (bool | None)\n    * Get(key:str) -> (str | None)\n    * Del(key:str) -> int\n    * Lock(key:str) -> RedisLock\n      * Acquire()\n      * Release()\n    * Queue(key:str) -> RedisQueue\n      * Size() -> int\n      * Put(item:str)\n      * Get(block=True, timeout=None) -> str\n  * MySQL(host: str, port: int, user: str, password: str, database: str, prefix:str = \"\") # \u8ddf5.7\u517c\u5bb9. \u56e0\u4e3aorator\u8ddf5.7\u517c\u5bb9, \u8ddf8.0\u4f1a\u6709\u5c0f\u95ee\u9898, \u4f5c\u8005\u5f88\u4e45\u4e0d\u66f4\u65b0, \u6709\u7a7a\u6362\u6389\u8fd9\u4e2aorm. **\u6ce8\u610f, Python\u7684MySQL\u64cd\u4f5c\u4e0d\u652f\u6301\u591a\u7ebf\u7a0b, \u9700\u8981\u6bcf\u4e2a\u7ebf\u7a0b\u8fde\u63a5\u4e00\u6b21MySQL, \u4e0d\u8fc7\u8fd9\u4e2a\u662f\u81ea\u52a8\u7684, \u5728Get, Update\u7b49\u64cd\u4f5c\u7684\u65f6\u5019\u5982\u679c\u94fe\u63a5\u5f02\u5e38\u5c31\u91cd\u8fde**\n  * SQLite(path: str, prefix:str = \"\") **\u7531\u4e8eSQLite\u6bcf\u6b21\u53ea\u80fd\u4e00\u4e2a\u7ebf\u7a0b\u8fdb\u884c\u64cd\u4f5c, \u6240\u4ee5\u8fd9\u91cc\u9ed8\u8ba4\u4f1a\u6709\u4e00\u4e2a\u9501, \u7ebf\u7a0b\u5b89\u5168**\n\n    * Queue(tbname:str, size:int=None) -> NamedQueue\n      * Size() -> int\n      * Get(wait=True) -> Any\n      * Put(string:Any)\n    * QueueConfirm(tbname:str, size:int=None, timeout:int=900) -> NamedConfirmQueue\n      * Size() -> int\n      * SizeStarted() -> int\n      * SizeTotal() -> int\n      * Get(wait=True) -> typing.Tuple[int, typing.Any]\n      * Put(item:typing.Any)\n      * Done(id:int)\n    * Execute(sql: str) -> (bool | int | list)\n    * Tables() -> list\n    * Table(tbname: str) -> MySQLSQLiteTable\n      * AddColumn(colname: str, coltype: str, default=None, nullable:bool = True) -> MySQLSQLiteTable\n      * AddIndex(*cols: str) -> MySQLSQLiteTable\n      * Fields(*cols: str) -> MySQLSQLiteTable\n      * Where(key:str, opera:str, value:str) -> MySQLSQLiteTable\n      * WhereIn(key:str, value: list) -> MySQLSQLiteTable\n      * WhereNotIn(key:str, value: list) -> MySQLSQLiteTable\n      * WhereNull(key:str) -> MySQLSQLiteTable\n      * WhereNotNull(key:str) -> MySQLSQLiteTable\n      * WhereBetween(key:str, start:int|float|str, end:int|float|str) -> MySQLSQLiteTable\n      * WhereNotBetween(key:str, start:int|float|str, end:int|float|str) -> MySQLSQLiteTable\n      * OrWhere(key:str, opera:str, value:str) -> MySQLSQLiteTable\n      * OrWhereIn(key:str, value: list) -> MySQLSQLiteTable\n      * OrderBy(*key:str) -> MySQLSQLiteTable\n      * Limit(num:int) -> MySQLSQLiteTable\n      * Paginate(size:int, page:int) -> MySQLSQLiteTable\n      * Data(value:map) -> MySQLSQLiteTable\n      * Offset(num:int) -> MySQLSQLiteTable\n      * Insert()\n      * Update()\n      * Delete()\n      * InsertGetID() -> int\n      * Exists() -> bool\n      * Count() -> int\n      * Find(id:int) -> map\n      * First() -> map\n      * Get() -> list\n      * Columns() -> list[map]\n    * KeyValue(tbname:str)\n      * Get(key:str) -> Any\n      * Set(key:str, value:Any)\n      * Del(key:str)\n      * Keys() -> list[str]\n\n\u5176\u5b83\u7684\n\n* Thread(func, *args:Any, daemon:bool=True) -> threading.Thread # \u542f\u52a8\u7ebf\u7a0b, daemon=True\n* Process(func, *args:Any, daemon:bool=True) -> multiprocessing.Process # \u542f\u52a8\u8fdb\u7a0b, daemon=True\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An all in one python library",
    "version": "0.74.46",
    "project_urls": {
        "Homepage": "https://github.com/darren2046/bagbag",
        "Repository": "https://github.com/darren2046/bagbag"
    },
    "split_keywords": [
        "base",
        " library"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "daccddb15f44435082e0d731c956164464094b5ffcbb0f00de6799216ad65880",
                "md5": "a694f45f1071088c1d9a48adb9a0f69d",
                "sha256": "b4ab2e2f6e4779c37000275db71c0dc9f6ee17088106cbc846999a081da13f92"
            },
            "downloads": -1,
            "filename": "bagbag-0.74.46-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a694f45f1071088c1d9a48adb9a0f69d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 1144891,
            "upload_time": "2024-12-20T03:33:16",
            "upload_time_iso_8601": "2024-12-20T03:33:16.721952Z",
            "url": "https://files.pythonhosted.org/packages/da/cc/ddb15f44435082e0d731c956164464094b5ffcbb0f00de6799216ad65880/bagbag-0.74.46-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15cda473e3b70fbe5aa189c4dabbfeee77f47d6671db73e4426f01f1449aeb29",
                "md5": "8b8258d1713daab34a6aaf8bcafa4e4b",
                "sha256": "432d8047ceac147609b4cbedfff53808f651c350a9780909e184cedb954ed736"
            },
            "downloads": -1,
            "filename": "bagbag-0.74.46.tar.gz",
            "has_sig": false,
            "md5_digest": "8b8258d1713daab34a6aaf8bcafa4e4b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 1035548,
            "upload_time": "2024-12-20T03:33:21",
            "upload_time_iso_8601": "2024-12-20T03:33:21.702737Z",
            "url": "https://files.pythonhosted.org/packages/15/cd/a473e3b70fbe5aa189c4dabbfeee77f47d6671db73e4426f01f1449aeb29/bagbag-0.74.46.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-20 03:33:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "darren2046",
    "github_project": "bagbag",
    "github_not_found": true,
    "lcname": "bagbag"
}
        
Elapsed time: 0.41937s