I am working on a project and this api http://icspy.readthedocs.io/en/v0.3.1/ seems good to implement the idea that I have however I face some issues and failed to find a solution and I hope this is the place to ask about this.
So what I am trying to do now is to import an ics file from an URL. (Note that I have tried with the physical ics file directly and it works just fine).
Using the provided sample code
from ics import Calendar
from urllib2 import urlopen # import requests
url = "http://ical.keele.ac.uk/index.php/ical/ical/15021113"
c = Calendar(urlopen(url).read().decode('iso-8859-1'))
And I end up getting an error message.
ValueError("container isn't an {}".format(self._TYPE))
ValueError: container isn't an VCALENDAR
What I have further discover is that when i call urlopen with the url it returns the file begginging with the b"
Actual file snippet
BEGIN:VCALENDAR VERSION:2.0 PRODID:-//hacksw/handcal//NONSGML v1.0//EN BEGIN:VEVENT
When calling urlopen(theurl)
b"BEGIN:VCALENDAR\rVERSION:2.0\rPRODID:-//hacksw/handcal//NONSGML v1.0//EN\rBEGIN:VEVENT\r
I couldn't manage to get rid of the b" at the beginning of the file and I think by removing that I might be able to parse it in properly?Same case when I tried with request. When i print out just urlopen(url) it shows a string of whats inside the ics file that includes "the ics files data inside quotes" I will be grateful if someone can give me some advice on this.