atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.29k stars 642 forks source link

unexpected keyword argument 'paging_workaround' #1397

Closed AnkeshThakur closed 2 weeks ago

AnkeshThakur commented 1 month ago

I was trying to use this library and while trying to get it work I find that this paging_workaround is wrong key here. Is it known issue?

The cause of it wrong param being passed to Jira._get_paged().

Stacktrace:

  File "/workspace/dora/jira_project.py", line 49, in <module>
    p = jp.get_project()
        ^^^^^^^^^^^^^^^^
  File "/workspace/dora/jira_project.py", line 24, in get_project
    projects = self.jira.get_all_projects(included_archived=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/atlassian/jira.py", line 2416, in get_all_projects
    return self.projects(included_archived, expand)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/atlassian/jira.py", line 2434, in projects
    self._get_paged(
TypeError: Jira._get_paged() got an unexpected keyword argument 'paging_workaround' 

Fix is very simple - just remove paging_workaround in this call

self._get_paged(
                     self.resource_url("project/search"),
                     params,
                     paging_workaround=True,
                 )

Associated PR: https://github.com/atlassian-api/atlassian-python-api/pull/1344/files#diff-160cdaa88ad7a2a6a2d2abd51b32052252fe4ec234c82030006888b10aca1bb0R2367

AnkeshThakur commented 1 month ago

Happy to send the PR for the fix if I'm not the only one facing this and community agrees to it.

gonchik commented 1 month ago

@AnkeshThakur feel free to send PR. regarding that get_paged, it's mix of cloud and non-cloud method. as I see time to wrap up

jamesweakley commented 1 month ago

I believe that paging workaround may have been due to https://github.com/atlassian-api/atlassian-python-api/issues/1310

So if you simply remove the parameter, it may go back to getting stuck in a loop for people with over 50 projects.

I wonder if the new parameter on _get_paged didn't make it through the merge somehow and just needs to be applied there.

Spacetown commented 1 month ago

But then the parameter need to be handled in the _getPaged function.

jamesweakley commented 1 month ago

I think it'd be the same as you see here: https://github.com/atlassian-api/atlassian-python-api/blob/33392bb506294297a571eb463a91ff644730908f/atlassian/bitbucket/cloud/base.py#L48

MarcelWilson commented 2 weeks ago

1344 seems to be when the change was made to Jira._get_paged but they forgot to add the new paging logic (as @jamesweakley pointed out) found in BitbucketBase