Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Provides url converters for flask to support pymonogs ObjectIDs

Project description

version license pyversions pipeline status coverage


Provides url converters for flask to support pymonogs ObjectIDs

I found the snippet from here by Armin Ronacher but could not find a package for it.


  • add the Converter to the flask app
  • use it in routes

Add Converter to app:

The package defines two converters to use:

  • ObjectIDConverter: stringify the id
  • Base64ObjectIDConverter: produces smaller strings by encoding to base64
from flask import Flask
from flask_objectid_converter import ObjectIDConverter

app = Flask(__name__)
app.url_map.converters['objectid'] = ObjectIDConverter

Use in routes

def get_user(oid):
    return User.objects.get(id=oid)

Throws 404 if the requested value cant be decoded

get route via url_for

from flask import url_for


python test

Possible extensions

Make the package a proper flask extension with init_app, encode, decode functions, configuration of conversion algorithm (specify alphabet)...


  • 1.0.0: Inital version. Encodes to base64 by default.
  • 2.0.0: Provide two converter classes. A simple one and a base64 encoding one. Drop python2 support.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for flask-objectid-converter, version 2.0.0
Filename, size File type Python version Upload date Hashes
Filename, size flask-objectid-converter-2.0.0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page