You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

random-object-id

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-object-id

Generate a random MongoDB ObjectId.

2.0.0
pipPyPI
Maintainers
1

Random ObjectId

Wheel Status

Motivation

This is a toy project without any outlandish goals. Occasionally I needed a MongoDB ObjectID for a unit test. This saves a DB query, starting mongo locally, writing more than a line of Python, or visiting a website. I also wanted to learn more about writing & deploying Python packages.

Dependencies

None

Supports

py36+. See GitHub workflow here.

Installation

$ pip install random-object-id

Usage

$ random_object_id -h
usage: random_object_id [-h] [-l]

Generate a random MongoDB ObjectId

optional arguments:
  -h, --help      show this help message and exit
  -l, --longform  prints the ID surrounded by ObjectId("...")
from random_object_id import generate

generate()  # => '5ecd3bbf875e60b4166f6699'

Examples

$ random_object_id
55348611a56c10449ab80a4f
$ random_object_id -l
ObjectId("553486125ed592a10c4e8e6b")

Keywords

random test MongoDB mongo ObjectId

FAQs

Did you know?

Socket

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.

Install

Related posts