
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Groupings of exceptions for working with network requests.
When making network requests in python there are a number of possible exceptions to due network issues. These are often a temporarily problem that should be prioritized separately from a bug in code. As a result handling them with a bare except is not safe but knowing exactly what exceptions to handle can be difficult.
.. code-block:: bash
pip install neterr
neterr provides the exception groups SocketErrors, StrictHTTPErrors, AmbiguousHTTPErrors and HTTPErrors.
.. code-block:: python
import urllib.request
from neterr import HTTPErrors
try:
urllib.request.urlopen('http://127.0.0.1').read()
except HTTPErrors:
print('caught!')
SocketErrors contains exceptions that may be raised while working with the socket module.
StrictHTTPErrors contains exceptions that may be raised while working with the http module and some common modules that use it (such as urllib and requests). This grouping only contains exceptions that are clearly not the result of code. They may be caused by an infrastructure or configuration problem and are often temporary.
StrictHTTPErrors is a superset of SocketErrors.
AmbiguousHTTPErrors contains exceptions that may be raised while working with the http module and some common modules that use it (such as urllib and requests). This grouping contains exceptions that may or may not be caused by code. The most common reason for this ambiguity is that they are the result of an HTTP response with a 4xx or 5xx status. It is recommended to handle 4xx and 5xx responses separately. 4xx responses are often caused by unvalidated user input or another code issue. 5xx responses are often caused by temporarily unavailability in a dependent service.
StrictHTTPErrors contains exceptions that may be raised while working with the http module and some common modules that use it (such as urllib and requests).
HTTPErrors is a superset of StrictHTTPErrors and AmbiguousHTTPErrors.
Exception groups provided by neterr can be combined with other exceptions using the add operator.
.. code-block:: python
from neterr import HTTPErrors
try:
raise MyException()
except HTTPErrors + MyException:
print('caught!')
try:
raise MyException()
except HTTPErrors + (MyException, MyOtherException):
print('caught!')
try:
raise MyException()
except HTTPErrors + [MyException, MyOtherException]:
print('caught!')
This package strictly follows semantic versioning <https://semver.org>
_.
FAQs
Useful groupings of exceptions for working with network requests.
We found that neterr 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.