Traitement de json (RFC7159)

Résolu/Fermé
FrouTieZ Messages postés 23 Date d'inscription dimanche 20 janvier 2013 Statut Membre Dernière intervention 3 décembre 2016 - Modifié par FrouTieZ le 18/07/2016 à 17:34
FrouTieZ Messages postés 23 Date d'inscription dimanche 20 janvier 2013 Statut Membre Dernière intervention 3 décembre 2016 - 26 juil. 2016 à 14:02
Bonjour,


Voilà je requête une api qui me retourne du json(RFC 7159), le json retourné est une string, voir ci dessous :

"BEGIN:VCALENDAR\r\nPRODID:-//BlueMind//BlueMind Calendar//FR\r\nVERSION:2.0\r\nCALSCALE:GREGORIAN\r\nBEGIN:VEVENT\r\nDTSTAMP:20160718T131441Z\r\nUID:72ce3005-5915-4bab-bad0-8bee44a95b0c\r\nDTSTART;TZID=Europe/Paris:20160719T160000\r\nSUMMARY:jjjjjk\r\nCLASS:PUBLIC\r\nPRIORITY:5\r\nSTATUS:CONFIRMED\r\nVERSION:2.0\r\nDTEND;TZID=Europe/Paris:20160719T200000\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nDTSTAMP:20160718T131441Z\r\nUID:b17bd40f-a568-44a7-bc12-954e940211c9\r\nDTSTART;TZID=Europe/Paris:20160718T193000\r\nSUMMARY:new_event(demo user)\r\nCLASS:PUBLIC\r\nPRIORITY:5\r\nSTATUS:CONFIRMED\r\nVERSION:2.0\r\nDTEND;TZID=Europe/Paris:20160719T000000\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nDTSTAMP:20160718T131441Z\r\nUID:06a1a21e-a150-4d26-8f74-b926964b7d06\r\nDTSTART;TZID=Europe/Paris:20160713T093000\r\nSUMMARY:test\r\nCLASS:PUBLIC\r\nPRIORITY:5\r\nSTATUS:CONFIRMED\r\nVERSION:2.0\r\nDTEND;TZID=Europe/Paris:20160713T123000\r\nTRANSP:OPAQUE\r\nEND:VEVENT\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Paris\r\nTZURL:http://tzurl.sgp1.cdn.digitaloceanspaces.com/zoneinfo-outlook/Europe/Paris.ics\r\nX-LIC-LOCATION:Europe/Paris\r\nBEGIN:DAYLIGHT\r\nTZOFFSETFROM:+0100\r\nTZOFFSETTO:+0200\r\nTZNAME:CEST\r\nDTSTART:19700329T020000\r\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\nEND:DAYLIGHT\r\nBEGIN:STANDARD\r\nTZOFFSETFROM:+0200\r\nTZOFFSETTO:+0100\r\nTZNAME:CET\r\nDTSTART:19701025T030000\r\nRRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\nEND:STANDARD\r\nEND:VTIMEZONE\r\nEND:VCALENDAR\r\n"


Désolé par avance pour la difficulté de lecture...
Ma question est: Comment puis-je traiter ces informations en python ?
Plus précisément je cherche à récupérer seulement certaines clés/valeurs comme si c'était un dictionnaire, le problème c'est que je trouve rien qui puisse formater ça de manière exploitable, pour l'instant je me place au bon endroit de la string pour récupérer ce qui m'intérresse mais c'est pas du tout dev-friendly et je doute que ça ne provoque aucun bugg à l'avenir... ( changement des paramètres retournés)
Merci pour votre considération :)

1 réponse

FrouTieZ Messages postés 23 Date d'inscription dimanche 20 janvier 2013 Statut Membre Dernière intervention 3 décembre 2016
26 juil. 2016 à 14:02
Problème résolu, pour ceux qui pourraient être intérréssés à l'avenir: rechercher icalendar sur google, y'à une lib python qui permet de traiter tout ça de manière très simplifiée.
0