Podbean logo
  • Discover
  • Podcast Features
    • Podcast Hosting

      Start your podcast with all the features you need.

    • Podbean AI Podbean AI

      AI-Enhanced Audio Quality and Content Generation.

    • Blog to Podcast

      Repurpose your blog into an engaging podcast.

    • Video to Podcast

      Convert YouTube playlists to podcasts, videos to audios.

  • Monetization
    • Ads Marketplace

      Join Ads Marketplace to earn through podcast sponsorships.

    • PodAds

      Manage your ads with dynamic ad insertion capability.

    • Apple Podcasts Subscriptions Integration

      Monetize with Apple Podcasts Subscriptions via Podbean.

    • Live Streaming

      Earn rewards and recurring income from Fan Club membership.

  • Podbean App
    • Podcast Studio

      Easy-to-use audio recorder app.

    • Podcast App

      The best podcast player & podcast app.

  • Help and Support
    • Help Center

      Get the answers and support you need.

    • Podbean Academy

      Resources and guides to launch, grow, and monetize podcast.

    • Podbean Blog

      Stay updated with the latest podcasting tips and trends.

    • What’s New

      Check out our newest and recently released features!

    • Podcasting Smarter

      Podcast interviews, best practices, and helpful tips.

  • Popular Topics
    • How to Start a Podcast

      The step-by-step guide to start your own podcast.

    • How to Start a Live Podcast

      Create the best live podcast and engage your audience.

    • How to Monetize a Podcast

      Tips on making the decision to monetize your podcast.

    • How to Promote Your Podcast

      The best ways to get more eyes and ears on your podcast.

    • Podcast Advertising 101

      Everything you need to know about podcast advertising.

    • Mobile Podcast Recording Guide

      The ultimate guide to recording a podcast on your phone.

    • How to Use Group Recording

      Steps to set up and use group recording in the Podbean app.

  • All Arts Business Comedy Education
  • Fiction Government Health & Fitness History Kids & Family
  • Leisure Music News Religion & Spirituality Science
  • Society & Culture Sports Technology True Crime TV & Film
  • Live
  • How to Start a Podcast
  • How to Start a Live Podcast
  • How to Monetize a podcast
  • How to Promote Your Podcast
  • How to Use Group Recording
  • Log in
  • Start your podcast for free
  • Podcasting
    • Podcast Features
      • Podcast Hosting

        Start your podcast with all the features you need.

      • Podbean AI Podbean AI

        AI-Enhanced Audio Quality and Content Generation.

      • Blog to Podcast

        Repurpose your blog into an engaging podcast.

      • Video to Podcast

        Convert YouTube playlists to podcasts, videos to audios.

    • Monetization
      • Ads Marketplace

        Join Ads Marketplace to earn through podcast sponsorships.

      • PodAds

        Manage your ads with dynamic ad insertion capability.

      • Apple Podcasts Subscriptions Integration

        Monetize with Apple Podcasts Subscriptions via Podbean.

      • Live Streaming

        Earn rewards and recurring income from Fan Club membership.

    • Podbean App
      • Podcast Studio

        Easy-to-use audio recorder app.

      • Podcast App

        The best podcast player & podcast app.

  • Advertisers
  • Enterprise
  • Pricing
  • Resources
    • Help and Support
      • Help Center

        Get the answers and support you need.

      • Podbean Academy

        Resources and guides to launch, grow, and monetize podcast.

      • Podbean Blog

        Stay updated with the latest podcasting tips and trends.

      • What’s New

        Check out our newest and recently released features!

      • Podcasting Smarter

        Podcast interviews, best practices, and helpful tips.

    • Popular Topics
      • How to Start a Podcast

        The step-by-step guide to start your own podcast.

      • How to Start a Live Podcast

        Create the best live podcast and engage your audience.

      • How to Monetize a Podcast

        Tips on making the decision to monetize your podcast.

      • How to Promote Your Podcast

        The best ways to get more eyes and ears on your podcast.

      • Podcast Advertising 101

        Everything you need to know about podcast advertising.

      • Mobile Podcast Recording Guide

        The ultimate guide to recording a podcast on your phone.

      • How to Use Group Recording

        Steps to set up and use group recording in the Podbean app.

  • Discover
  • Log in
    Sign up free
Python Bytes

Python Bytes

Technology

#278 Multi-tenant Python applications

#278 Multi-tenant Python applications

2022-04-08
Download Right click and do "save link as"

Watch the live stream:

Watch on YouTube

About the show

Sponsored by: Microsoft for Startups Founders Hub.

Special guest: Vuyisile Ndlovu

Brian #1: dunk - a prettier git diff

  • Darren Burns
  • Uses Rich
  • “⚠️ This project is very early stages” - whatever, I like it.
  • Recommendation is to use less as a pager for it
    • git diff | dunk | less -R

Michael #2: Is your Python code vulnerable to log injection?

  • via Adam Parkin
  • Let’s just appreciate log4jmemes.com for a moment
  • Ok, now we can talk about Python
  • We can freak our the logging with line injection
"hello'.\nINFO:__main__:user 'alice' commented: 'I like pineapple pizza"

Results in two lines for one statement

INFO:__main__:user 'bob' commented: 'hello'. INFO:__main__:user 'alice' commented: 'I like pineapple pizza'.
  • The safest solution is to simply not log untrusted text. If you need to store it for an audit trail, use a database.
  • Alternatively, structured logging can prevent newline-based attacks.
  • Padding a ton? One such case is abusing padding syntax. Consider this message:
  • *"%(user)999999999s"*
  • This will pad the user with almost a gigabyte of whitespace.
  • Mitigation: To eliminate these risks, you should always let logging handle string formatting.
  • See this discussion: Safer logging methods for f-strings and new-style formatting

Vuyisile #3: Building multi tenant applications with Django

  • Free book by Agiliq, covers different approaches to building Software as a service applications in Python/Django.
  • Covers four approaches to multi tenancy, namely:
    1. Shared database with shared schema
    2. Shared database with isolated schema
    3. Isolated database with a shared app server
    4. Completely isolated tenants using Docker

Brian #4: Should you pre-allocate lists in Python?

  • Redowan Delowar
  • Discussion of 3 ways to build up a list
    • Start empty and append: l=[]; l.append(1); …
    • Pre-allocate: l = [None] * 10_000; …
    • List comprehension: l = [i for i in range(10_000)]
  • Interesting discussion and results
    • The times (filling the list with the index):
      • append: 499 µs ± 1.23 µs
      • pre-allocate: 321 µs ± 71.1
      • comprehension: 225 µs ± 711
    • Python lists dynamically allocate extra memory when they run out, and it’s pretty fast at doing this.
    • Pre-allocation can save a little time.
    • Conclusion: use comprehensions when you can, otherwise, don’t sweat it unless you really need to shave off as much time as possible
  • Of note: this was just measuring time, no discussion of memory usage.

Michael #5: mockaroo and tonic

  • Do you need to generate fake data?
  • Mockaroo let’s you generate realistic data based data types (car registrations, credit cards, dates, etc)
  • Tonic takes your actual production data and reworks it into test data (possibly striping out PII)

Vuyisile #6:

  • Brachiograph —the cheapest, simplest possible Python powered pen plotter by Daniele Procida
  • Low tech Raspberry Pi project that can be built for < $50 using common household objects like a clothes peg ice cream stick

Extras

Brian:

  • April 8 new date for Python Issues migrating to GH

Michael:

  • ngrok has a detailed web explorer

Vuyisile:

  • Thunder Client : VS Code extension, Lightweight client for testing REST APIs Postman alternative

Joke: Linux world in tatters

Related: Origin of the joke - Lapsus$ claims to leak 90% of Microsoft Bing's source code

view more

More Episodes

#258 Python built us an anime dog!
2021-11-11
#257 Python Launcher - Launching Python Everywhere
2021-11-04
#256 And the best open source project prize goes to ...
2021-10-29
#255 Closember eve, the cure for Hacktoberfest?
2021-10-20
#254 Do Excel things, get notebook Python code with Mito
2021-10-13
#253 A new Python for you, and for everyone!
2021-10-07
#252 Jupyter is now a desktop app!
2021-09-29
#251 A 95% complete episode (wait for it)
2021-09-22
#250 skorch your scikit-learn together with PyTorch
2021-09-15
#249 All of Linux as a Python API
2021-09-09
#248 while True: stand up, sit down
2021-09-02
#247 Do you dare to press "."?
2021-08-26
#246 Love your crashes, use Rich to beautify tracebacks
2021-08-11
#245 Fire up your Python time machine (and test some code)
2021-08-04
#244 vendorizing your Python podcast
2021-07-30
#243 Django unicorns and multi-region PostgreSQL
2021-07-21
#242 from lib import * but less
2021-07-15
#241 f-yes we want some f-string tricks!
2021-07-07
#240 This is GitHub, your pilot speaking...
2021-07-02
#239 No module named pythonbytes
2021-06-23
  • ←
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • →
012345678910111213141516171819

Get this podcast on your
phone, FREE

Download Podbean app on App Store Download Podbean app on Google Play

Create your
podcast in
minutes

  • Full-featured podcast site
  • Unlimited storage and bandwidth
  • Comprehensive podcast stats
  • Distribute to Apple Podcasts, Spotify, and more
  • Make money with your podcast
Get started

It is Free

  • Podcast Services

    • Podcast Features
    • Pricing
    • Enterprise Solution
    • Private Podcast
    • The Podcast App
    • Live Stream
    • Audio Recorder
    • Remote Recording
    • Podbean AI
  •  
    • Create a Podcast
    • Video Podcast
    • Start Podcasting
    • Start Radio Talk Show
    • Education Podcast
    • Church Podcast
    • Nonprofit Podcast
    • Get Sermons Online
    • Free Audiobooks
  • MONETIZATION & MORE

    • Podcast Advertising
    • Dynamic Ads Insertion
    • Apple Podcasts Subscriptions
    • Switch to Podbean
    • YouTube to Podcast
    • Blog to Podcast
    • Submit Your Podcast
    • Podbean Plugins
    • Developers
  • KNOWLEDGE BASE

    • How to Start a Podcast
    • How to Start a Live Podcast
    • How to Monetize a Podcast
    • How to Promote Your Podcast
    • Mobile Podcast Recording Guide
    • How to Use Group Recording
    • Podcast Advertising 101
  • Support

    • Support Center
    • What’s New
    • Free Webinars
    • Podcast Events
    • Podbean Academy
    • Podbean Amplified Podcast
    • Badges
    • Resources
  • Podbean

    • About Us
    • Podbean Blog
    • Careers
    • Press and Media
    • Green Initiative
    • Affiliate Program
    • Contact Us
  • Privacy Policy
  • Cookie Policy
  • Terms of Use
  • Consent Preferences
  • Copyright © 2015-2025 Podbean.com