通过URL订阅Google和Outlook日历,引起问题

发布于 2025-01-23 23:36:44 字数 1126 浏览 2 评论 0原文

我正在使用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

URL:

示例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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文