Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
bepatient is a library aimed at facilitating work with asynchronous applications. It allows for the repeated execution of specific actions until the desired effect is achieved.
To install bepatient, you can use pip:
pip install bepatient
bepatient supports Python 3.10+
Using RequestsWaiter object:
from requests import get
from bepatient import RequestsWaiter
waiter = RequestsWaiter(request=get("https://example.com/api"))
waiter.add_checker(comparer="contain", expected_value="string")
waiter.run()
response = waiter.get_result()
assert response.status_code == 200
Simple way:
from requests import get
from bepatient import wait_for_value_in_request
response = wait_for_value_in_request(
request=get("https://example.com/api"),
comparer="contain",
expected_value="string"
)
assert response.status_code == 200
If we need add more than one checker:
from requests import get
from bepatient import wait_for_values_in_request
list_of_checkers = [
{
"checker": "json_checker",
"comparer": "contain",
"expected_value": "string"
},
{
"checker": "headers_checker",
"comparer": "is_equal",
"expected_value": "cloudflare",
"dict_path": "Server",
},
]
response = wait_for_values_in_request(
request=get("https://example.com/api"),
checkers=list_of_checkers,
retries=5,
)
assert response.status_code == 200
MIT License
Copyright (c) 2023-2024 Dawid Szaniawski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A library facilitating work with asynchronous APIs
We found that bepatient demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.