简体   繁体   English

如何使用MindBody API python获取所有客户端

[英]How I can get all Clients with MindBody API python

I am trying to get all clients using MindBody API , I tried this, 我正在尝试使用MindBody API获得所有客户端 ,我尝试了这个,

from suds.client import Client
from Helper.ClientService import ClientServiceMethods

# Making a call
calls = ClientServiceMethods()
result = calls.GetAllClients()
client_dict = Client.dict(result)
clients = client_dict['Clients']
client_list = clients.Client # transferring clients into a python list

#printing the lenght of received clients list
print len(client_list)

the above code will work but the issue is that it will not pull of more than 27 client, that's it. 上面的代码可以工作,但问题是它不会吸引超过27个客户端,仅此而已。 from MindBody Docs the GettAllClients should get up to 1000 client, the limit for a call is 1000 which means i can get up to 1000, but the problem is that I am note able to get at least that 1000, I am only getting 27 clients. MindBody DocsGettAllClients应该最多可以容纳1000个客户端,一个呼叫的限制是1000,这意味着我最多可以容纳1000个客户端,但是问题是我注意到至少能够获得1000个客户端,而我只能获得27个客户端。

Note: I am working with Demo Data, Sandbox which can anyone look them, I used the Sample code from their MindBody Python repository 注意:我正在使用演示数据,沙箱,任何人都可以看它们,我使用了MindBody Python存储库中的示例代码

I am working on getting all clients data through the api,these clients can viewed from here 我正在通过api获取所有客户端数据,这些客户端可以从此处查看

Username: Siteowner | 用户名: Siteowner | Password: apitest1234 密码: apitest1234

for anyone who's having problems with this too, this will be a big help for you. 对于任何对此也有疑问的人,这将对您有很大帮助。

when we make call GetClients, mindbody will send clients but it will represent them in form of pages so that 25 client was the first page if u want to get the next 25 client you would have to call the page indexed 2 and so on and so forth. 当我们打电话给GetClients时,心体将发送客户端,但它将以页面的形式表示它们,因此如果您想获得下一个25个客户端,则25个客户端是第一页,您必须调用索引为2的页面,依此类推向前。

in code this is how u would do this, using API Example code ClientService , do this inside the method GetClientsByString 在代码中,这就是您将如何使用API示例代码 ClientService执行此操作,该方法在GetClientsByString方法中进行

def GetClientsByString(self, searchStr):
        """Convenience method to find clients containing searchStr in their name or e-mail."""
        request = self.CreateBasicRequest("GetClientsRequest")

        # Since SearchText is just a string, we can assign it directly.
        request.SearchText = searchStr
        request.CurrentPageIndex = 1 # increase this number by one each time 

        return self.service.service.GetClients(request)

This is how I approached it; 这就是我的处理方式; very open to a better way that's not as API intensive: 非常开放,可以找到一种不占用大量API的更好方法:

    clientService = ClientServiceCalls()

    #get all client IDs

    clientResponse = clientService.GetClientsByString('')
    clientList = clientResponse.Clients.Client

    clientVisitsDict = []

    for c in clientList:

        #Call get ClientVisits API on each Client ID

        clientResponseVisits = clientService.GetClientVisits(str(c.ID))

        if clientResponseVisits.Visits:
            visitsList = clientResponseVisits.Visits.Visit
            for v in visitsList:

                ### your code here

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Mindbody API集成阻止程序 - Mindbody API integrations blocker 在异步中,我如何将数据发送到所有或某些客户端? - In asyncore how can i send data to all or some of the clients? 如何让多个客户端在python中连接到同一源? - How do I get multiple clients to connect to the same source in python? 如何在TCP Python聊天服务器上拥有多个客户端? - How can I have multiple clients on a TCP Python Chat Server? 如何在 python 的列表中保留已连接客户端的列表? - How can I keep a list of connected clients in a list in python? 如果我安装了多个Tortoise客户端(Git,SVN),如何获取python脚本以找到正确的Tortoise.exe? - How can I get a python script to find the right Tortoise.exe if I have multiple Tortoise clients (Git, SVN) installed? 如何在RPyC中获取连接到服务器的客户端列表? - How can I get the list of clients connected to a server in RPyC? 如何从快速 api 获取所有路由路径? - how can i get all routes path from fast api? 如何使用 python 和 ML 在粒度级别细分客户端? - How can i segment clients on granular level using python and ML? 如何获取文件 python 中第一行之后的所有行? - How can i get all the lines after the first in a file python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM