Skip to main content

Blues's core library

Project description

Description

Python library writed by Blues Liu.

blues-lib

pytest

# windows
pytest tests/xx.test.ts

# macos
python3 -m pytest tests/xx.test.ts

Install

install by requirements.txt

pip install -r requirements.txt
// first installation 
pip install blues-lib==1.3.14

// upgrade to the newest version
pip install --upgrade blues-lib

sele

BluesDebugChrome

reliant env variables
  1. $env:CHROME_EXE : the chrome's .exe file path - * required
  • such as C:\Users\creep\AppData\Local\Google\Chrome\Application\chrome.exe
  1. $env:CHROME_DRIVER_EXE : the chromedriver's .exe file path - * recommended
  • such as D:\devsoftware\Python38\webdriver\chrome\128.0.6613.86\chromedriver.exe
  1. $env.LOGINER_EXECUTOR : the loginer program path
  • dated setting: D:\devapp\seleniumapp\loginer\Starter.py
input
config = {
  'url':'http://deepbluenet.com',
}
arguments = {
  '--user-data-dir':'"c:/sele/test3"',
  '--remote-debugging-address':'localhost:8003',
}

util

from blues_lib.util.BluesFiler import BluesFiler

print(BluesFiler.exists('dir'))

set/get env variables

// set
[Environment]::SetEnvironmentVariable('LOGINER_EXECUTOR', 'D:\devapp\seleniumapp\loginer\Starter.py','machine')
// get
[Environment]::GetEnvironmentVariable('LOGINER_EXECUTOR','machine')

QA

Selenium Wire CA error

ERROR:cert_verify_proc_builtin.cc(766)] CertVerifyProcBuiltin for at.alicdn.com failed:
----- Certificate i=1 (CN=Selenium Wire CA) -----

Resolve:

  1. download ca.crt from selenium-wire library
https://github.com/wkeeling/selenium-wire/blob/master/seleniumwire/ca.crt

Execute by powershell scheduled task

task

unRegister-ScheduledTask -TaskName 'srp'
Get-ScheduledTask -TaskName 'srp'
Start-ScheduledTask -TaskName 'srp'
Get-ScheduledTaskInfo -TaskName 'srp'
enable-ScheduledTask -TaskName 'srp'
disable-ScheduledTask -TaskName 'srp'

task in 24hours

$arg='-NoProfile -command "& {set-location -path D:\devapp\pyapp\blues-lib-py\test\srp; python .\NAPSTest.py}"' ;  $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $arg ; 
$now = Get-Date ; 
$interval = New-TimeSpan -Hours 2; 
$trigger = New-ScheduledTaskTrigger -Once -RepetitionInterval $interval -At $now ; 
Register-ScheduledTask -Action $action  -Trigger $trigger -TaskName 'srp' 

task in 7:00-23:00

$arg = '-NoProfile -command "& {set-location -path D:\devapp\pyapp\blues-lib-py\test\srp; python .\NAPSTest.py}"'
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $arg

$startTime = Get-Date -Hour 7 -Minute 0 -Second 0

$trigger = New-ScheduledTaskTrigger -Daily -At $startTime -RepetitionInterval (New-TimeSpan -Hours 2) -RepetitionDuration (New-TimeSpan -Hours 16)

Register-ScheduledTask -Action $action -Trigger $trigger -TaskName 'srp'
# define the execute order
$arg='-NoProfile -command "& {set-location -path D:\devapp\pyapp\blues-lib-py\test\srp; python .\NAPSTest.py}"' ;  

# create task
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $arg ; 

$startTime = (Get-Date).Date.AddHours(7);
$interval = New-TimeSpan -Hours 2;
$endTime = (Get-Date).Date.AddHours(23);

# define the trigger
$trigger = New-ScheduledTaskTrigger -Daily -At $startTime -RepetitionInterval $interval -RepetitionDuration ($endTime - $startTime)

Register-ScheduledTask -Action $action  -Trigger $trigger -TaskName 'srp' 

exe

$chrome="'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'" ; $arg='-NoProfile -command "& { set-location -path D:\datacross\dist\App; .\App.exe '+$chrome+' }"' ;  $action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument $arg ; $now = Get-Date ; $interval = New-TimeSpan -Hours 1; $trigger = New-ScheduledTaskTrigger -Once -RepetitionInterval $interval -At $now ; Register-ScheduledTask -Action $action  -Trigger $trigger -TaskName 'datacross' 

install

This develop pc will push pip to officail reigstry ,can't set the mirros

pip install -i https://mirrors.aliyun.com/pypi/simple selenium
pip install -i https://mirrors.aliyun.com/pypi/simple --upgrade selenium

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blues_lib-1.9.22.tar.gz (141.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blues_lib-1.9.22-py3-none-any.whl (275.8 kB view details)

Uploaded Python 3

File details

Details for the file blues_lib-1.9.22.tar.gz.

File metadata

  • Download URL: blues_lib-1.9.22.tar.gz
  • Upload date:
  • Size: 141.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for blues_lib-1.9.22.tar.gz
Algorithm Hash digest
SHA256 c891d401c6793fc6f946b98f447e13eb555348fed687b01cb14861e44d1ad37e
MD5 4f5ca2a5a2b4bf48a67e169f504a1916
BLAKE2b-256 5890f93a05b7f4cbdb3b82803c8cde43e1d3dca7ad6335e3e640ada9a9f006b9

See more details on using hashes here.

File details

Details for the file blues_lib-1.9.22-py3-none-any.whl.

File metadata

  • Download URL: blues_lib-1.9.22-py3-none-any.whl
  • Upload date:
  • Size: 275.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for blues_lib-1.9.22-py3-none-any.whl
Algorithm Hash digest
SHA256 8a9675d754d3d7d06c43b9aea211908c8d9fcc2789bc532b682381b311f51ecc
MD5 d5c2d3dca0cc1383084558c9a5c7bb32
BLAKE2b-256 753b09a3e44c5a47762d0a8f98ffbd725a8115b29f32ead8a07e0279e5e32b9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page