Python praw 模块,exceptions() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用praw.exceptions()

项目:XternSlackBot    作者:brubakbd    | 项目源码 | 文件源码
def get_subreddit_content(subreddit_name, error_msg):
    try:
        reddit_inst = praw.Reddit(client_id=client_id,
                            client_secret=client_secret,
                            password=password,
                            user_agent='contentscript by /u/pimpdaddyballer',
                            username=username)

        puppies_subreddit = reddit_inst.subreddit(subreddit_name)

        return puppies_subreddit.random().url

    except praw.exceptions.ClientException as e:
        print(e)
        return None
    except praw.exceptions as e:
        print(e)
        return error_msg