How to get cursor from mqlread() when using Freebase API?

前端 未结 2 559
逝去的感伤
逝去的感伤 2021-01-16 14:54

I\'m using the Python-Freebase module\'s mqlread(). Using the following query:

query = [{
  \"cursor\": True,
  \"id\":     None,
  \"type\":   \"/games/gam         


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-16 15:46

    I found that the Freebase-Python module actually includes a method that takes care of cursoring for you. Just call mqlreaditer(query, extended=true), and that will return a Python generator that you can iterate through. Behind the scenes the Freebase module will query and keep track of the cursor, return results on demand until a "false" cursor is reached.

    Very simple!

提交回复
热议问题