通过URL订阅Google和Outlook日历,引起问题
我正在使用Django Rest框架和Icalendar进行一个项目。我创建了一个API,该API提供了用于下载的ICS文件。 向用户提供了用于订阅的下载API的URL。但是,他们在订阅时经历了意外的行为。 对于Google日历,它根本不会自动重新同步。在一个实例中,日历已成功订阅,但在Google日历上没有显示任何事件。
任何人都可以帮助确认Google日历是否存在问题,还是我缺少一些东西。例如,未正确生成文件。
示例
@action(detail=True, methods=['get'], permission_classes=[AllowAny], authentication_classes=[])
def download_file(self, request, *args, **kwargs):
instance = self.get_object()
ics_data = instance.ics_data
file_name = "somefile"
response = HttpResponse(ics_data.encode(), content_type='text/calendar')
response['Content-Disposition'] = 'attachment; filename=%s.ics' % file_name
return response
示例ICS数据:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//my company calendar//
BEGIN:VEVENT
SUMMARY:This Event
DTSTART;VALUE=DATE-TIME:20220321T054500Z
DTEND;VALUE=DATE-TIME:20220321T070000Z
DTSTAMP;VALUE=DATE-TIME:20220419T085236Z
UID:113874
DESCRIPTION:Some Event
LOCATION:My Studio
END:VEVENT
END:VCALENDAR
I'm working on a project using Django Rest Framework and icalendar. I've created an api which provides ics file for download.
Users are provided with a url to the download api which they use to subscribe. However they are experiencing unexpected behaviour upon subscription.
In case of google calendar it doesn't resync automatically at all. In one instance the calendar was subscribed successfully but there were no events being displayed on google calendar.
Can anyone help confirm whether there is an issue with google calendar or am I missing something. for example not generating the file correctly
views.py
@action(detail=True, methods=['get'], permission_classes=[AllowAny], authentication_classes=[])
def download_file(self, request, *args, **kwargs):
instance = self.get_object()
ics_data = instance.ics_data
file_name = "somefile"
response = HttpResponse(ics_data.encode(), content_type='text/calendar')
response['Content-Disposition'] = 'attachment; filename=%s.ics' % file_name
return response
sample url:
https://api-mycompany.com/users/11184/calendar/download_file/
sample ics data:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//my company calendar//
BEGIN:VEVENT
SUMMARY:This Event
DTSTART;VALUE=DATE-TIME:20220321T054500Z
DTEND;VALUE=DATE-TIME:20220321T070000Z
DTSTAMP;VALUE=DATE-TIME:20220419T085236Z
UID:113874
DESCRIPTION:Some Event
LOCATION:My Studio
END:VEVENT
END:VCALENDAR
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论