Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Google Calendar iCal
#2
You need to decode to eg to utf-8 when read with in urlopen in Python 3.
If not you get byte string back.
c = Calendar(urlopen(url).read().decode('utf-8'))
Output:
https://calendar.google.com/calendar/ical/t6l47q578aqr8qjc3pq8cdnfv0%40group.calendar.google.com/public/basic.ics     <!doctype html>         <html>         <head>             <meta charset="utf-8">             <title>Test</title>             <style>             body {margin: 3em;}             header {background: #eee; padding: 1em;}             article {padding: 2em;}             </style>         </head>         <body>
Had you used Request then there is no need for decode.
Requests is getting correct encoding from web-site.
c = Calendar(requests.get(url).text)
Same output as over.
Reply


Messages In This Thread
Google Calendar iCal - by Albireo - Mar-14-2017, 12:02 PM
RE: Google Calendar iCal - by snippsat - Mar-14-2017, 03:40 PM
RE: Google Calendar iCal - by Albireo - Mar-15-2017, 03:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Online calendar for booking. SpongeB0B 6 3,643 Nov-15-2023, 11:27 AM
Last Post: Woki
  Follow Up: Web Calendar based Extraction AgileAVS 0 1,535 Feb-23-2020, 05:39 AM
Last Post: AgileAVS
  Extracting Data from Calendar AgileAVS 2 3,805 Feb-16-2020, 01:06 PM
Last Post: AgileAVS
  Google calendar pthon flask auth Kireta 0 2,149 Sep-16-2019, 04:50 PM
Last Post: Kireta

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020