Metadata-Version: 2.4
Name: odysseeapi
Version: 0.2.0
Summary: Unofficial Python API for Odyssee
Author-email: Géry Casiez <gery.casiez@univ-lille.fr>
Project-URL: Repository, https://github.com/casiez/OdysseeAPI
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Description-Content-Type: text/markdown

[![PyPI Version](https://img.shields.io/pypi/v/odysseeapi)](https://pypi.org/project/odysseeapi/)
[![Downloads](https://static.pepy.tech/badge/odysseeapi)](https://pepy.tech/project/odysseeapi)

# Odyssee API

Provides an unofficial API for the [Odyssee platform](https://odyssee.enseignementsup-recherche.gouv.fr/), allowing users to access and interact with their data programmatically.

## Features

- download applications of candidates
- get information about candidates
- get information about committee members
- get information about institutions
- get keywords
- assign applications to committee members
- download reports from committee members
- provide decision on each candidate after the first round of evaluation

## Installation

```bash
pip install odysseeapi
```

## Getting the authentication token
1. Go to the [Odyssee platform](https://odyssee.enseignementsup-recherche.gouv.fr/) using Chrome
1. Open the developer tools (F12 or right-click and select "Inspect")
1. Go to the "Network" tab
1. Refresh the page
1. Look for a request 
    - Click on the request and go to the "Headers" tab
    - Look for the "Authorization" header and copy its value (it should start with "Bearer")
1. Copy the token and use it in your code to authenticate with the API

Note that the authentication uses both cookies and a bearer token, so you need to provide both to access the API.
The API automatically handles the cookie (using [browsercookie](https://pypi.org/project/browsercookie/)), so you only need to provide the bearer token.

Note that the token is valid for a limited time, so you may need to repeat this process periodically to obtain a new token.

![image](bearer.png)

## Minimal example

```python
from odysseeapi.Odyssee import Odyssee

numposte = "123456"
token = """eyJhbGciOiJSUzI1N... (token value) ..."""

# Initialize the API client with the numposte, token and use_cache set to True
# setting use_cache to False forces the API client to fetch fresh data from the server for each request, while setting it to True allows the client to use cached data if available
odyssee = Odyssee(numposte, token, True)

# Download the applications of the candidates in the specified directory
odyssee.download_applications('dossiers_candidats')

candidates = odyssee.get_candidates()
print(candidates)

rapporteurs = odyssee.get_committee_members()
print(rapporteurs)

etablissements = odyssee.get_institutions()
print(etablissements)

keywords = odyssee.get_keywords()
print(keywords)

candidates_with_details = odyssee.get_candidates_with_details()
print(candidates_with_details)

# odyssee.assign_jury_members_to_candidate("f1e2d3c4-b5a6-4789-9876-543210fedcba", "98765432-10fe-dcba-9876-543210fedcba", "abcd1234-5678-90ef-ghij-klmnopqrstuv")

# Download the reports of the committee members for the candidates in the specified directory
odyssee.downloadReports("rapports_odyssee")

# A l'issue de la première réunion du jury, enregistrer l'avis pour chaque candidat et les résultats du vote
# odyssee.opinion_for_interview("f1e2d3c4-b5a6-4789-9876-543210fedcba", "A", "Motif audition", 16, 16, 0, 0, 16, 0)
```
