Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A package that provides timezone support for MongoDB bson -> https://api.mongodb.com/python/current/api/bson/index.html
MongoDB bson is great - but it doens't allow for timezone support. This package rectifies that.
This package provides a new dumps
and loads
method that overrides the ~bson.json_util.dumps
and ~bson.json_util.load
functions
in a few key places to support timezones - everything else works in the same way as in the core package.
pip install bson_timezone
bson_timezone
handle timezone aware and timezone naive datetimes.
bson_timezone
retains all existing functionality of ~bson.json_util.dumps
- meaning you can provide json_options
to configure the output
as required.
>>> from datetime import datetime
>>> from bson_timezone import bson_tz_dumps
>>> import pytz
>>> timezone = pytz.timezone("America/New_York")
>>> dt = datetime(2020,6,20,12,30,45).astimezone(timezone)
>>> bson_tz_dumps(dt)
'{"$date": 1592652645000, "$zone": "America/New_York", "$offset": {"total_seconds": -14400.0}}'
>>> from datetime import datetime
>>> from bson_timezone import bson_tz_loads
>>> dumped_data = '{"$date": 1592652645000, "$zone": "America/New_York", "$offset": {"total_seconds": -14400.0}}'
>>> bson_tz_loads(dumped_data)
datetime.datetime(2020, 6, 20, 7, 30, 45, tzinfo=<DstTzInfo 'America/New_York' EDT-1 day, 20:00:00 DST>)
>>> from datetime import datetime
>>> from bson_timezone import bson_tz_dumps
>>> dt = datetime(2020,6,20,12,30,45)
>>> bson_tz_dumps(dt)
'{"$date": 1592656245000, "$zone": null, "$offset": null}'
>>> from datetime import datetime
>>> from bson_timezone import bson_tz_loads
>>> dumped_data = '{"$date": 1592656245000, "$zone": null, "$offset": null}'
>>> bson_tz_loads(dumped_data)
datetime.datetime(2020, 6, 20, 7, 30, 45)
python setup.py test
FAQs
Provides timezone support for bson.json_util.dumps and bson.json_util.loads
We found that bson-timezone 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.