开发者

How to set the max_results value from the gdata.codesearch API higher than 10?

开发者 https://www.devze.com 2023-02-22 09:52 出处:网络
Hi can someone tell me how to use the gdata Codesearch API and augment the number of results from the Query higher than 10 ?

Hi can someone tell me how to use the gdata Codesearch API and augment the number of results from the Query higher than 10 ?

I allr开发者_如何学编程eady check the CodesearchExample.py from Code Google Gdata - CodesearchExample , but couldn't find a way to do it.

Anyone got an idea ?


You can't directly use GetSnippetsFeed like the example does. GetSnippetsFeed is actually a wrapper that creates a CodesearchQuery object without any parameters. If you create that object yourself you can set the max_results property.

service = gdata.codesearch.service.CodesearchService(source='my_test_app-1.0')
query = gdata.codesearch.service.CodesearchQuery(text_query="search text")
query.max_results=15
feed = service.Query(query.ToUri())
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号