示例#1
0
文件: main.py 项目: newslynx/zuckup
    def f(*args, **kw):
      
      # check kw's
      kw = validate_kw(kw, requires)

      # optionally connect to the api
      api = opt_connect(**kw)

      # add defautls to kw's
      kw = dict(kw.items() + default.items())
        
      # get args
      args = catch_err(func, api, **kw)

      if gen:
        if kw.get('concurrent'):
          return concurrent_yield(parser, args, **kw)

        else:
          return (parser(a) for a in args)

      else:
        return parser(args)
示例#2
0
        def f(*args, **kw):

            # check kw's
            kw = validate_kw(kw, requires)

            # optionally connect to the api
            api = opt_connect(**kw)

            # add defautls to kw's
            kw = dict(kw.items() + default.items())

            # if were not paginating simply
            # run the function
            if not kw['paginate']:
                tweets = catch_err(func, api, **kw)
            else:
                tweets = paginate(func, api, **kw)

            # optionally run concurrent
            if kw['concurrent']:
                return concurrent_yield(parse_tweet, tweets, **kw)

            else:
                return (parse_tweet(t) for t in tweets)
示例#3
0
    def f(*args, **kw):
      
      # check kw's
      kw = validate_kw(kw, requires)

      # optionally connect to the api
      api = opt_connect(**kw)

      # add defautls to kw's
      kw = dict(kw.items() + default.items())

      # if were not paginating simply
      # run the function
      if not kw['paginate']:
        tweets = catch_err(func, api, **kw)
      else:
        tweets = paginate(func, api, **kw)

      # optionally run concurrent
      if kw['concurrent']:
        return concurrent_yield(parse_tweet, tweets, **kw)

      else:
        return (parse_tweet(t) for t in tweets)