I began by modifying the parse_search_results(obj, api) method in
parsers.py to the following:
def parse_search_results(obj, api):
searchresults = api.model_factor.search_results()
setattr(searchresults, 'max_id', obj['max_id'])
setattr(searchresults, 'since_id', obj['since_id'])
results = obj['results']
result_objects = []
for item in results:
result_objects.append(parse_search_result(item, api)
setattr(searchresults, 'results', result_objects)
return searchresults
In a script, I call the search:
searchresults = tweepy.api.search
(q=keywordphrase,lang='en',rpp=100,since_id=since_id)
print searchresults.max_id
Which yields an error:
AttributeError: 'list' object has no attribute 'max_id'
I'm still wet behind the ears in Python, so I may be doing something
completely stupid here. I made the changes in Tweepy source, then ran
this. Am I on the right track, or am I missing something significant?
thx,
j
You can not set attributes directly on a list. I will fix this issue
in the future, but for now you can try this fix.
Define this class in models.py:
class SearchResults(list):
pass
And add this to the ModelFactory class:
search_results = SearchResults
That should do the trick. Let me know if you run into any more issues.
Josh
See this [1] commit for more details.
Josh
[1] http://github.com/joshthecoder/tweepy/commit/68c0f829361faecf35664df8744183d2cf68be6b
2010/1/22 Pascal Jürgens <pascal....@googlemail.com>: