Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging message with Params shows nothing when using lookup_users #706

Closed
joshusre opened this issue Mar 2, 2016 · 1 comment
Closed
Labels
Bug This is regarding a bug with the library
Milestone

Comments

@joshusre
Copy link

joshusre commented Mar 2, 2016

I noticed that when I call lookup_users, the params aren't in my log like other functions.

Code:

def get_info(master_acct, tweepy_conn, friends_list): """ Takes list of ids and looks up info for each one, writing results to db as it goes :param master_acct: :param tweepy_conn: :param friends_list: :return: """ # Break friend list into chunks the twitter API can work with chunked_list = utils.chunk(friends_list, 100) processed_counter = 1 logging.info("Processing {0} chunks.".format(len(chunked_list))) user_data_list = [] chunk_counter = 0 #look up users in batches while chunk_counter < len(chunked_list): user_list = [] chunk = chunked_list[chunk_counter] # Get user daata for sqlite logging.info("Processing Chunk {0} of {1}".format(int(chunk_counter) + 1, len(chunked_list))) for result in tweepy_conn.lookup_users(user_ids=chunk): logging.info("Processing #{0} of {1}: {2}".format(processed_counter, len(friends_list), result.screen_name)) #do cool shit user_data_list.append(user_data_dict) logging.info("Added #{0} of {1}: {2}".format(processed_counter, len(friends_list), result)) chunk_counter += 1 return user_data_list
Log:

[22:06:18] {C:\VM_Gateway\demo_code\app\bin\tw_func.py:194} INFO - Processing 37 chunks.
[22:06:18] {C:\VM_Gateway\demo_code\app\bin\tw_func.py:202} INFO - Processing Chunk 1 of 37
[22:06:18] {C:\Python27\lib\site-packages\tweepy\binder.py:107} INFO - PARAMS: {}

Using usertimeline:

[22:06:19] {C:\Python27\lib\site-packages\tweepy\binder.py:107} INFO - PARAMS: {'count': '200', 'include_retweets': 'False', 'screen_name': 'INF1N1TEMUSIC'}

Am I doing something wrong?

@Harmon758
Copy link
Member

Harmon758 commented Apr 28, 2019

This is a side effect of how the actual bound method for API.lookup_users is called indirectly, without directly passing the parameters:

tweepy/tweepy/api.py

Lines 326 to 352 in 1a2fa72

def lookup_users(self, user_ids=None, screen_names=None, include_entities=None, tweet_mode=None):
""" Perform bulk look up of users from user ID or screen_name """
post_data = {}
if include_entities is not None:
include_entities = 'true' if include_entities else 'false'
post_data['include_entities'] = include_entities
if user_ids:
post_data['user_id'] = list_to_csv(user_ids)
if screen_names:
post_data['screen_name'] = list_to_csv(screen_names)
if tweet_mode:
post_data['tweet_mode'] = tweet_mode
return self._lookup_users(post_data=post_data)
@property
def _lookup_users(self):
""" :reference: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup
allowed_param='user_id', 'screen_name', 'include_entities', 'tweet_mode'
"""
return bind_api(
api=self,
path='/users/lookup.json',
payload_type='user', payload_list=True,
method='POST',
allowed_param=['user_id', 'screen_name', 'include_entities', 'tweet_mode']
)

For code block usage, see https://help.github.com/articles/creating-and-highlighting-code-blocks/.

@Harmon758 Harmon758 added the Bug This is regarding a bug with the library label Apr 28, 2019
@Harmon758 Harmon758 added this to the 3.9 milestone Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is regarding a bug with the library
Projects
None yet
Development

No branches or pull requests

2 participants