Project

General

Profile

Python-Redmine returned unknown error with the status code 406

Added by Alen Badrajan over 5 years ago

I am trying to download a report.csv file, but I am getting constantly the error code 406
My code:
from redminelib import Redmine
import os
import requests
from dotenv import load_dotenv

load_dotenv()
API_KEY = os.getenv('key')
redmine = Redmine('https://redmine.titanium.codes', key=API_KEY, version='2.1.1')
entries = redmine.time_entry.all()
entries.export('csv', filename='entries.csv')

I read that this might be caused by the missing user-agent,
redmine = Redmine('https://redmine.titanium.codes', key=API_KEY, version='2.1.1', data={'user-agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36'}) , but as I looked in the source code, there is no such options as providing data or headers for the request.

Any ideas on how to fix this issue?