Gitlab API : Get project's Events with python

508 views Asked by At

I'm coding a script in python and try to get EVENTS from a project with gitlab API.

Here is the code :

import gitlab

# private token or personal token authentication
gl = gitlab.Gitlab('https://gitlab.com/', private_token='My_private_token')

gl.auth()

# Get a target project by ID
project_id = 21847546
project = gl.projects.get(project_id)

now when i try to get EVENTS from this project but i got an url to the events and not json object:

event=project._links['events']

print(event)

Return :

https://gitlab.com/api/v4/projects/21847546/events

What should i do in order to get events list in json data form ?

1

There are 1 answers

2
Maks Babarowski On

You can get a list of events on a project with:

events = project.events.list()