Giter VIP home page Giter VIP logo

Comments (9)

hunyadi avatar hunyadi commented on August 14, 2024

Can you elaborate on what Confluence is returning? HTTP 200 OK is an expected HTTP status code. Is there no response body? If there is a body, what does it contain? (From the error message, it looks like it's not JSON.)

from md2conf.

GMous avatar GMous commented on August 14, 2024

I'm not very familiar with python and confluence API, but I've just inserted "print(response)" in api.py before line 188 and I got string "<Response [200]>".

from md2conf.

hunyadi avatar hunyadi commented on August 14, 2024

When you do a print(response), Python would print the string representation of the object held in the variable response as defined by the object type. Developers of the Requests library have likely opted to do a compact representation that prints the status code, and nothing else. What would be interesting to know is what the actual response payload is. Normally, this should be a JSON string, which is de-serialized automatically into a Python object when calling response.json(). Since the function call to response.json() is triggering an error, you would need to call print on response.text, which could produce the response body as-is, revealing what Confluence is returning.

from md2conf.

GMous avatar GMous commented on August 14, 2024

Thanks for info.
I've checked it and found that response.text contains HTML, indicating that my user doesn't have access to the page. However, this page is in my own user space and doesn't have any restrictions. Additionally, I've tried creating a simple custom script using the atlassian-python-api module, and it works with the same initial data (token, space key, page id).

from md2conf.

hunyadi avatar hunyadi commented on August 14, 2024

Looking at the implementation of the class AtlassianRestAPI in the library atlassian-python-api, it looks way more complex than the basic authentication scheme available in md2conf. I would need to understand which exact authentication path is taken in AtlassianRestAPI such that it could be reproduced in the corresponding API wrapper in md2conf. For example, I could include requests-oauthlib in md2conf but we would need to identify first if this is indeed what is lacking in your case.

from md2conf.

GMous avatar GMous commented on August 14, 2024

I've used authentication with a personal access token in the following way:
confluence = Confluence(url=confluence_url, token=api_token)

It seems that it simply adds an "Authorization" header with the value "Bearer {token}".format(token=token).

from md2conf.

hunyadi avatar hunyadi commented on August 14, 2024

If you don't pass a user name, md2conf will also call

session.headers.update({"Authorization": f"Bearer {self.api_key}"})

Perhaps you have a stray setting that assigns the environment variable CONFLUENCE_USER_NAME and thus invokes the HTTP basic authentication path in md2conf as opposed to the desired HTTP bearer authentication path (as in AtlassianRestAPI).

from md2conf.

GMous avatar GMous commented on August 14, 2024

I was digging deep into debugging when I realised that I had missed the default value of the wiki PATH parameter. I feel so silly. Really sorry for your time. I've just added -p / to parameters and it works now.

from md2conf.

hunyadi avatar hunyadi commented on August 14, 2024

That's great news! Don't worry; the important point is that you got it working in the end.

from md2conf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.