Giter Club home page Giter Club logo

posthog-python's Introduction

PostHog Python

PyPI

Please see the main PostHog docs.

Specifically, the Python integration details.

Questions?

Local Development

Testing Locally

  1. Run python3 -m venv env (creates virtual environment called "env")
  2. Run source env/bin/activate (activates the virtual environment)
  3. Run python3 -m pip install -e ".[test]" (installs the package in develop mode, along with test dependencies)
  4. Run make test

Running Locally

Assuming you have a local version of PostHog running, you can run python3 example.py to see the library in action.

Running the Django Sentry Integration Locally

There's a sample Django project included, called sentry_django_example, which explains how to use PostHog with Sentry.

There's 2 places of importance (Changes required are all marked with TODO in the sample project directory)

  1. Settings.py

    1. Input your Sentry DSN
    2. Input your Sentry Org and ProjectID details into PosthogIntegration()
    3. Add POSTHOG_DJANGO to settings.py. This allows the PosthogDistinctIdMiddleware to get the distinct_ids
  2. urls.py

    1. This includes the sentry-debug/ endpoint, which generates an exception

To run things: make django_example. This installs the posthog-python library with the sentry-sdk add-on, and then runs the django app. Also start the PostHog app locally. Then navigate to http://127.0.0.1:8080/sentry-debug/ and you should get an event in both Sentry and PostHog, with links to each other.

posthog-python's People

Contributors

casio avatar edscode avatar fuziontech avatar gagantrivedi avatar hungsiro506 avatar jamesefhawkins avatar macobo avatar mariusandra avatar neilkakkar avatar paolodamico avatar timgl avatar twixes avatar yakkomajuri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.