我有一个会合页面,里面有一个日历(请查看下面的照片)。日历我试图从这个日历中提取信息,比如每天有多少个事件。没别的了。
我使用了来自堆栈溢出的代码,该代码使用API读取汇流页。但是json响应不包含有关页面中日历的任何数据。
`import requests
import json
from requests.auth import HTTPDigestAuth
confluence_host = "https://confluence.tools.mycompany.com"
url = confluence_host + '/rest/api/content/'
page_id = "36013799"
page = requests.get(url=url + page_id,
params={'expand': 'body.storage'},
auth=('my_user', 'my_password') ).json()`
即使我编写html =page‘’body‘value并检查它的输出,它也只给出如下结果:
ac:macro-id="99a26d73-abaa-45a1-92cc-0edafec567f5">72da4ae5-4888-46dd-9078-0299b51ab815,743a55b4-7b3b-4e00-b102-90d95916de8d :name=-version=“1”
有什么方法可以得到日历信息吗?
谢谢
发布于 2018-11-28 21:22:09
通过查看GET和PUT,javascript插件(rest/calendar-services/1.0/calendar/events.json):使用了rest。
你需要找出你的:亚卡宪兵=‘你的to’
urlC = 'City&start=2018-11-28T00%3A00%3A00Z&end=2018-11-28T00%3A00%3A00Z‘
R= requests.get(urlC,auth=("myuser","mypass"),timeout=15)
将返回该期间的所有记录:
A= r.json()
a.keys()
你‘事件’,你‘成功’
“成功”
真的
类型(a‘’events‘)
列表
(“事件”)
61
使用PUT中的下列数据添加新事件:
数据={ "subCalendarId":"xxx-xxx-xxx","eventType":“定制”,"customEventTypeId":"xxx-xxx-xxx","what":"My Test","person":"xxxxxxxxxxxxxxxxx","startDate":“28-11月-2018年”,"startTime":"15:00","endDate":“28-11月-2018年11月-2018年”,"endTime":"16:00","allDayEvent":“假”,"editAllInRecurrenceSeries":“真”,"where":“某地”,“描述”:“我的测试用例”,"userTimeZoneId":“美国/墨西哥城”,}
urlC = 'https://yourconfluence.com/rest/calendar-services/1.0/calendar/events.json‘
R= requests.put(urlC,auth=(用户名,pass),data=data,timeout=15)
这将返回一个“成功”:对于新条目是正确的:
U‘{“成功”:true,"subCalendar":{"reminderMe":false,.}
https://stackoverflow.com/questions/44412554
复制相似问题