Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Support HTTPS forcing in PRAW 2
import praw
from functools import wraps
def init_wrapper(func):
def func_wrapper(*args, **kwargs):
ret = func(*args, **kwargs)
if ret:
ret._site_url = ret._site_url.replace('http:', 'https:')
ret._short_domain = ret._site_url.replace('http:', 'https:')
return ret
return func_wrapper
praw.Config.__init__ = init_wrapper(praw.Config.__init__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment