Giter Site home page Giter Site logo

confluence-python-lib's People

Contributors

davetcode avatar dependabot-preview[bot] avatar dependabot[bot] avatar exaldraen avatar johnadders avatar mjp4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

confluence-python-lib's Issues

KeyError: 'title' on confluence.client.Confluence.get_content()

When paginating through the confluence.client.Confluence.get_content() method I am running into a KeyError when trying to fetch the title field from a content response. The rest of the fields in content appear on that record and the rest of my application works just fine except for this one bad item. I feel like title should be a required field or at least be a blank string but now it just blows up in my face. I am running Confluence version 6.15.9

Traceback (most recent call last):
  File "/Users/jquick/.virtualenvs/matrix-7HUYJ2hm/lib/python3.6/site-packages/celery/app/trace.py", line 385, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/Users/jquick/.virtualenvs/matrix-7HUYJ2hm/lib/python3.6/site-packages/celery/app/trace.py", line 648, in __protected_call__
    return self.run(*args, **kwargs)
  File "/Users/jquick/Box/Projects/matrix/confluence_app/tasks.py", line 23, in confluence_spaces
    confluence_space_content(space.key)
  File "/Users/jquick/.virtualenvs/matrix-7HUYJ2hm/lib/python3.6/site-packages/celery/local.py", line 191, in __call__
    return self._get_current_object()(*a, **kw)
  File "/Users/jquick/.virtualenvs/matrix-7HUYJ2hm/lib/python3.6/site-packages/celery/app/trace.py", line 649, in __protected_call__
    return orig(self, *args, **kwargs)
  File "/Users/jquick/.virtualenvs/matrix-7HUYJ2hm/lib/python3.6/site-packages/celery/app/task.py", line 394, in __call__
    return self.run(*args, **kwargs)
  File "/Users/jquick/Box/Projects/matrix/confluence_app/tasks.py", line 31, in confluence_space_content
    for content in client.get_content(ctype, space_key, expand=['history']):
  File "/Users/jquick/.virtualenvs/matrix-7HUYJ2hm/lib/python3.6/site-packages/confluence/client.py", line 139, in _get_paged_results
    yield item_type(result)
  File "/Users/jquick/.virtualenvs/matrix-7HUYJ2hm/lib/python3.6/site-packages/confluence/models/content.py", line 69, in __init__
    self.title = json['title']  # type: str
KeyError: 'title'

The site I am pulling this from is private but here is response content (with some info scrubbed for privacy)

{
    "_expandable": {
        "ancestors": "",
        "body": "",
        "children": "/rest/api/content/12345/child",
        "container": "/rest/api/space/webDomain",
        "descendants": "/rest/api/content/12345/descendant",
        "metadata": "",
        "operations": "",
        "restrictions": "/rest/api/content/12345/restriction/byOperation",
        "space": "/rest/api/space/webDomain",
        "version": ""
    },
    "_links": {
        "edit": "/pages/resumedraft.action?draftId=12345",
        "self": "https://confluence.internal.com/rest/api/content/12345",
        "tinyui": "/x/XXXXX",
        "webui": "/pages/viewpage.action?pageId=12345"
    },
    "extensions": {
        "position": "none"
    },
    "history": {
        "_expandable": {
            "contributors": "",
            "lastUpdated": "",
            "nextVersion": "",
            "previousVersion": ""
        },
        "_links": {
            "self": "https://confluence.internal.com/rest/api/content/12345/history"
        },
        "createdBy": {
            "_expandable": {
                "status": ""
            },
            "_links": {
                "self": "https://confluence.internal.com/rest/api/user?key=0987654321"
            },
            "displayName": "Justin Quick",
            "profilePicture": {
                "height": 48,
                "isDefault": false,
                "path": "/download/attachments/555/user-jquick-ldap-image.png",
                "width": 48
            },
            "type": "known",
            "userKey": "0987654321",
            "username": "jquick"
        },
        "createdDate": "2013-01-10T12:08:49.000-05:00",
        "latest": true
    },
    "id": "12345",
    "status": "current",
    "type": "page"
}

Authentication failure

I am trying to play around with this library but I am getting authentication error

import sys
from confluence.client import Confluence
from confluence.models.content import ContentType

def main():
    with Confluence('https://pradeepchhetri.atlassian.net/wiki', ('[email protected]', 'xxx')) as c:
        spaces = c.get_spaces(space_keys=['Core'])
        print(len(list(spaces)))

if __name__ == '__main__':
    sys.exit(main())
Traceback (most recent call last):
  File "test.py", line 15, in <module>
    sys.exit(main())
  File "test.py", line 8, in main
    print(len(list(spaces)))
  File "/Library/Python/2.7/site-packages/confluence/client.py", line 126, in _get_paged_results
    response = self._get(path, params, [])
  File "/Library/Python/2.7/site-packages/confluence/client.py", line 112, in _get
    Confluence._handle_response_errors(path, params, response)
  File "/Library/Python/2.7/site-packages/confluence/client.py", line 84, in _handle_response_errors
    raise ConfluenceAuthenticationError(path, params, response)
confluence.exceptions.authenticationerror.ConfluenceAuthenticationError: Authentication failure. This is most likely due to incorrect username/password

I am able to login with the same username and password in https://id.atlassian.com/login

Can you help me with some pointers to debug this issue.

Thank you.

Bug in add_attachments method

In add_attachment method :
return self._post_return_multiple(Content,
'/content/{}/child/attachment'.format(content_id),
params=params,
files={'file': (file_name, f)},
data={})

You should remove the slash before 'content', like this : 'content/{}/child/attachment'.format(content_id) , because further, when you will concatenate this string with self._api_base , you will optain something like this: http;//<'adress to confluence'>/rest/api//content/<'content id'>/child/attachment

Bug in _put method

Hi !
I was trying the create_content method and i noticed that at some point it is called the _put method. In this method you check if params is not None, but in my opinion you should check if expand is not None

How to get Web Link from get_content() on a page ?

Hello,

I want to have the URL for the end-user to be able to click to the Wiki page.
Seems the info is in _links.webui, but cannot retrieve that on a Content object.
Limited to Attachement ? seems to be so in code.

Can you please help here ?

tests get installed to site-packages

While I don't really have a strong opinion on tests being installed when installing a package, I do mind when they get installed as a top-level package in my site-packages! pip install tests actually will install something.

Might I also recommend a rename of the top-level confluence package? I know it's an ideal name right now but the deprecated xmlrpc library currently has the same name so after a pip install, they'll be stepping on each others' toes on the filesystem.

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

requests.exceptions.SSLError SSL: CERTIFICATE_VERIFY_FAILED

Hi!
When I'm trying to create initial connection, I getting the following stacktrace:

requests.exceptions.SSLError: HTTPSConnectionPool(host='confluence.federated.fds', port=443): Max retries exceeded with url: /confluence/rest/api/content/search?cql=ID%3D1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)')))

Our confluence have an expired certificate and I can't update it right now, is there any way to provide verify=False to requests without monkey-patching?

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.