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

Bearer token on Linux environment has new line character #1337

Open ashishpatel1992 opened 4 months ago

ashishpatel1992 commented 4 months ago

Environment

Oracle Linux 8.6
Python 3.9.13
pip 23.1.2
atlassian-python-api 3.39.0

It appears that \n is getting appended when generating bearer token


Traceback (most recent call last):
  File "/tmp/aaspatel_test/confluence_uploader.py", line 48, in <module>
    new_page=create_page_under_parent(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/utils/operations.py", line 55, in create_page_under_parent
    space_key = confluence_instance.get_page_space(parent_id)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/atlassian/confluence.py", line 258, in get_page_space
    return ((self.get_page_by_id(page_id, expand="space") or {}).get("space") or {}).get("key") or None
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/atlassian/confluence.py", line 346, in get_page_by_id
    response = self.get(url, params=params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/atlassian/rest_client.py", line 288, in get
    response = self.request(
               ^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/atlassian/rest_client.py", line 241, in request
    response = self._session.request(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 496, in _make_request
    conn.request(
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/urllib3/connection.py", line 399, in request
    self.putheader(header, value)
  File "/tmp/aaspatel_test/venv/lib/python3.11/site-packages/urllib3/connection.py", line 313, in putheader
    super().putheader(header, *values)
  File "/home/opc/.pyenv/versions/3.11.4/lib/python3.11/http/client.py", line 1264, in putheader
    raise ValueError('Invalid header value %r' % (values[i],))
ValueError: Invalid header value b'Bearer OTQ5Nzc3MjIxNzM2OsGGJBpfw6U16GLuiItcQu9W+AU6\n'
`