MCPcopy
hub / github.com/postmanlabs/httpbin / random_bytes

Function random_bytes

httpbin/core.py:658–671  ·  view source on GitHub ↗

Returns n random bytes generated with given seed.

(n)

Source from the content-addressed store, hash-verified

656
657@app.route('/bytes/<int:n>')
658def random_bytes(n):
659 """Returns n random bytes generated with given seed."""
660 n = min(n, 100 * 1024) # set 100KB limit
661
662 params = CaseInsensitiveDict(request.args.items())
663 if 'seed' in params:
664 random.seed(int(params['seed']))
665
666 response = make_response()
667
668 # Note: can't just use os.urandom here because it ignores the seed
669 response.data = bytearray(random.randint(0, 255) for i in range(n))
670 response.content_type = 'application/octet-stream'
671 return response
672
673
674@app.route('/stream-bytes/<int:n>')

Callers

nothing calls this directly

Calls 1

CaseInsensitiveDictClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…