Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

551
Vistas
How do I know when a Google calendar event was added there or deleted from there?

I want to sync my own calendar (react-big-calendar) with a Google Calendar. I can retrieve Google calendar events from a primary calendar and display them in my own calendar built using react-big-calendar library. When I add a new event to a Google calendar, I want to see the event added to my own calendar as well without reloading the page. Because on every reload I call a function that fetches the events from a Google Calendar. But I need to do that once there is a change to a Google Calendar. How can I do that?

Backend: python, django

Frontend: react js

        # authorization
        def get_crendetials_google():
            flow = InstalledAppFlow.from_client_secrets_file(
                "credentials.json", SCOPES)
            creds = flow.run_local_server(port=8080)
            pickle.dump(creds, open("token.txt", "wb"))
            return creds

        
        @api_view(['GET'])
        def get_all_events(request):
            creds = None
            if path.exists("token.txt"):
                creds = pickle.load(open("token.txt", "rb"))
            if not creds or not creds.valid:
                if creds and creds.expired and creds.refresh_token:
                    creds.refresh(Request())
                else:
                    creds = get_crendetials_google()
            result = []

            # instantiating a calendar and retrieving google events
            try:
                service = build("calendar", "v3", credentials=creds)
                response = service.events().list(calendarId="primary").execute()
                for event in response["items"]:
                    title = event.get("summary")
                    obj = {}
                    if title:
                        obj["title"] = title
                        obj["start"] = event["start"]
                        obj["end"] = event["end"]
                        result.append(obj)
                result = reformat_events(request, result)
            except OSError as err:
                return Response({'error': "OS error: {0}".format(err)}, status=400)
            return Response(result, status=200)

  useEffect(() => {
      getEvents();
  }, []);

  const getEvents = async () => {
    let response = await fetch("http://localhost:8000/gcevents/", {
      method: "GET",
      headers: {
        "Content-Type": "application/json",
        Authorization: "Bearer " + String(authTokens.access),
      },
    });
    let data = await response.json();

    if (data) {
      props.sendEvents(data);
    }
  };

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda