Skip to content

v0.4.8

Compare
Choose a tag to compare
@clgwlg clgwlg released this 06 Nov 09:14

Features

#122 Support user-defined browser cookies

  • cookies <List[Dict]>#
    • name <str>
    • value <str>
    • url <str> either url or domain / path are required. Optional.
    • domain <str> either url or domain / path are required Optional.
    • path <str> either url or domain / path are required Optional.
    • expires <float> Unix time in seconds. Optional.
    • httpOnly <bool> Optional.
    • secure <bool> Optional.
    • sameSite <"Strict"|"Lax"|"None"> Optional.
'''
Following is add cookie example
1. modify before_all_extend method in pscript/dsl/hook.py of your project
2. define your cookies and add it into global cache
3. flybirds will add cookies into browser
'''
from flybirds.core.global_context import GlobalContext

def before_all_extend(context):
    cookies = [{'name': 'taskid1', 'value': 'TYUUI12345ty1', "url": "https://hotel.trip.com"},
               {'name': 'taskid2', 'value': 'TYUUI12345ty2', "url": "https://hotel.trip.com"}]
    GlobalContext.set_global_cache("cookies", cookies)