【发布时间】:2017-08-23 10:11:33
【问题描述】:
我能够连接到Mind Body api 并运行一个简单的命令来获取所有客户端数据
from Helper.ClientService import ClientServiceCalls
calls = ClientServiceCalls()
clients = calls.GetAllClients()
print(clients)
服务器将响应这些信息:
(GetClientsResult){
Status = "Success"
ErrorCode = 200
XMLDetail = "Full"
ResultCount = 4503
CurrentPageIndex = 0
TotalPageCount = 181
Clients =
(ArrayOfClient){
Client[] =
(Client){
MobileProvider = None
AppointmentGenderPreference = "None"
Gender = "Female"
IsCompany = False
LiabilityRelease = False
PromotionalEmailOptIn = True
CreationDate = 2017-02-23 00:00:00
Liability =
(Liability){
IsReleased = False
AgreementDate = None
ReleasedBy = None
}
UniqueID = 100015484
ID = "100015484"
FirstName = "Sdfoij"
LastName = "[asodfj"
EmailOptIn = True
State = "CA"
Country = "US"
BirthDate = None
FirstAppointmentDate = 2017-03-03 00:00:00
HomeLocation =
(Location){
SiteID = -99
BusinessDescription = ""The MINDBODY Health Club Demo is awesome." - Anonymous (but probably someone cool and smart)"
AdditionalImageURLs = ""
FacilitySquareFeet = None
TreatmentRooms = None
HasClasses = True
PhoneExtension = None
ID = 1
Name = "Clubville"
}
PhotoURL = "https://clients.mindbodyonline.com/studios/DemoAPISandboxRestore/clients/100015484_large.jpg?v=98"
IsProspect = False
Status = "Active"
ContactMethod = 1
}.... **and continue printing other client informations**
}
}
现在问题是我想从中提取这些信息,
Client Email, Client Name, Client Phone Number, Client Status (active or inactive), Client Birthday, Client Address, Most Recent Visit Date, Most Recent Visit Description, Start Date, Custom Field(s)
但我不知道我可以使用什么库来解析这个输出,我正在考虑 Beautiful Soup 但我不太确定,
我真的是使用 api 的新手,所以如果有人能给我一个关于如何做到这一点的想法,那就太好了。
【问题讨论】:
标签: python python-3.x api parsing xml-parsing