コード例 #1
0
ファイル: main.py プロジェクト: newslynx/birdfeeder
def user_stats(**kw):
    """
  Get stats about a user. 
  Since we're using a different parser
  and not paginating we wont use
  the decorator 
  """
    def _get_user(api, **kw):
        return api.show_user(**kw)

    # connect
    kw = validate_kw(kw, ['screen_name'])
    api = opt_connect(**kw)
    screen_name = kw.get('screen_name')
    user = catch_err(_get_user, api, **kw)
    return parse_user_stats(user, screen_name)
コード例 #2
0
ファイル: main.py プロジェクト: newslynx/birdfeeder
def user_stats(**kw):
  """
  Get stats about a user. 
  Since we're using a different parser
  and not paginating we wont use
  the decorator 
  """
  def _get_user(api, **kw):
    return api.show_user(**kw)

  # connect
  kw = validate_kw(kw, ['screen_name'])
  api = opt_connect(**kw)
  screen_name = kw.get('screen_name')
  user = catch_err(_get_user, api, **kw)
  return parse_user_stats(user, screen_name)
コード例 #3
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)
コード例 #4
0
ファイル: main.py プロジェクト: newslynx/birdfeeder
        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)
コード例 #5
0
ファイル: main.py プロジェクト: newslynx/birdfeeder
    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)