re: using python's Requests to access the REST API

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
ewong
Posts: 1
Joined: 20 Dec 2019, 02:43

re: using python's Requests to access the REST API

Post by ewong »

Hi,

This isn't a question. Just a tidbit that I encountered while trying to use python's request module to grab information off a local mantisbt setup. I was having a lot of trouble figuring it out as while using 'curl ... --headers 'Authorization: <token>'" worked, using the requests get() didn't work. I think this can be included in the REST api documentation somehow.

While debugging the code in restcore, (via echo'ing ;P), I noticed that the information in the headers was particularly strange. The user information pertained to some ftp site that I used, and immediately, I went into the ~/.netrc and with the added information from [1], I found that the python request module used my .netrc's information instead of the headers provided. Renaming the .netrc to something else, and then re-running the script finally worked.

FWIW, and fyi.

Edmund

[1] - https://2.python-requests.org/en/master ... entication
Post Reply