# Getting Authorization Error Python

**URL:** <https://community.developer.atlassian.com/t/getting-authorization-error-python/54711>\
**Category:** Confluence Server\
**Tags:** python, rest-api\
**Created:** [December 29, 2021, 2:09am UTC](https://community.developer.atlassian.com/t/getting-authorization-error-python/54711 "2021-12-29T02:09:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VinaySingh](https://avatars.discourse-cdn.com/v4/letter/v/d26b3c/32.png) [@VinaySingh](https://community.developer.atlassian.com/u/VinaySingh)\
**Post date:** [December 29, 2021, 2:09am UTC](https://community.developer.atlassian.com/t/getting-authorization-error-python/54711/1 "2021-12-29T02:09:22Z")

</div>

Hi All ,

I am trying to access a page using Python script.  
I have created a Personal Access Token and used it in the Python code.  
My Code :

```python
import requests
import json
from requests.auth import HTTPBasicAuth
import base64

encoded = base64.b64encode(b'Email Id : Personalized Access Token')
print ( encoded )

url = "url/<pageid>/child/attachment?start=0&limit=1000" 

headers = {
    'Authorization': "Basic <encoded string copied here >",
    'Cache-Control': "no-cache",
    }

proxies = {
 "http": <proxy>,
 "https": <proxy> ,
}

params1 = (
    ('status', 'current'),
)

params2 = (
    ('status', 'trashed'),
)

response = requests.request("GET", url, headers=headers, proxies=proxies)
json_out=response.json()

```

I am getting the below error:

```bash
SSLError: HTTPSConnectionPool(host='confluence.xyz.com', port=443): Max retries exceeded with url: (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),))

```

Can someone please help , I have tried all permutations and combinations and read many pages but unable to fix this error.

---

<div class="post-metadata">

**Author:** ![jrichards](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/jrichards/32/39455_2.png) [@jrichards](https://community.developer.atlassian.com/u/jrichards)\
**Post date:** [January 4, 2022, 4:02am UTC](https://community.developer.atlassian.com/t/getting-authorization-error-python/54711/2 "2022-01-04T04:02:12Z")

</div>

Hi,

First of all, if you’re accessing [confluence.nomura.com](http://confluence.nomura.com/) then you want the [Jira Server REST apis](https://developer.atlassian.com/server/jira/platform/rest-apis/), not the Cloud REST apis.

It’s likely the error isn’t your authentication. Looking at the error it says it’s an SSL error with `bad handshake` and `ssl3_get_server_certificate`. Does the site run on a self generated SSL certificate or one that has incomplete certification chain? If so, you’ll need to provide Python with the missing certificates.

Depending on your system, for example if it’s Ubuntu or Debian, you can run `sudo apt install ca-certificates` and this may add the certificate to the system. Or with Windows try `pip install python-certifi-win32`.

But if you have your own certificate chain you’ll need to let Python know about the certificates with something like

```python
response = requests.request("GET", url, headers=headers, proxies=proxies, verify = 'mycerts.pem')

```

You can also check out [some other responses](https://stackoverflow.com/questions/51925384/unable-to-get-local-issuer-certificate-when-using-requests-in-python) if they help.

Regards,  
James.
