Open glichtner opened 1 year ago
Sorry to only react to these issues after a year, I was rather busy.
Your solution doesn't seem the cleanest, however if we can use _session
to extract the relvant session cookie, I'd be okay with it, as in this case we are not interfering with atlassian's object state. I would not route our requests through it directly, as they might rely on some state there.
In either case if this is still a problem for you, please provide a proposed fix that doesn't involve routing requests through their _session
object.
for me to make it work with token auth I had to do following changes:
- self.__confluence = Confluence(url=urlunparse(self.__parsed_url),
- username=self.__username,
- password=self.__token)
+ self.__confluence = Confluence(url=urlunparse(self.__parsed_url), token=self.__token)
+ # username=self.__username,
+ # password=self.__token)
and
- r = requests.get(att_url, auth=(self.__username, self.__token), stream=True)
+ r = requests.get(att_url, headers={"Auth":"Bearer "+self.__token}, stream=True)
Hi, thanks for providing the package!
I've been unable to download attachments with the package, as I kept getting a "401 Unauthorized" error. After removing /wiki/ from the download url (see #22), the problem is that - at least with our Confluence server - token-based authorization doesn't seem to work for downloading attachements, whereas password-based authorization doesn't work for API calls.
My solution was to use the
requests.session
object of the confluence python package, as it has the appropriate session/auth cookies after API calls, instead of using the requests module directly:I changed the following line:
https://github.com/gergelykalman/confluence-markdown-exporter/blob/3506ce2a697bfea97a7423dfd1442bf504c9885e/confluence-markdown-export.py#L95
To:
I would open a pull request, but I'm using a protected attribute (
_session
) of an external package (confluence) and I don't know how stable that attribute is. However, if anyone else experiences this problem, this might help.