I have been trying to replace files using google API only with the Python HTTPS module. Can somebody please help me with how I can replace the file only with an HTTPS module?

```
import sys
import json
import requests
import sys

Acesstoken = ""

params = {
        "grant_type": "refresh_token",
        "client_id": "xxx",
        "client_secret": "xxxx",
        "refresh_token": "xxxx"
        }

authorization_url = "https://www.googleapis.com/oauth2/v4/token"

r = requests.post(authorization_url, data=params)

if r.ok:
    token = str((r.json()['access_token']))
    Refreshtoken = Acesstoken + token
else:
    print('Failed')
    sys.exit()

headers = {
    "Authorization": "Bearer " + str(Acesstoken),
    }

metadataF= {
    'name': "Test",
    'parents':["1vXn346cBsarvkPthqtI1OLzsMzeQQlBX"]
}

files = {
    'data':('metadata', json.dumps(metadataF), 'application/json; charset=UTF-8'), 
    'file': open("./credentials.json", "rb"),
    }

r2= requests.post(
    "https://www.googleapis.com/upload/drive/v3/files/XXXXXXXX?uploadType=multipart",
    headers= headers,
    files= files
)

print(r2)

```

I only want to use Python's Https Module only. I don't want to use google client library. Please help me if this is possible.

Error

> 
> <Response [401]> with this ` { "error": { "errors": [ { "domain": "global", "reason": "authError", "message": "Invalid Credentials", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Invalid Credentials" }
> 
> 
> 

[![enter image description here](https://i.stack.imgur.com/S3Q7p.png)](https://i.stack.imgur.com/S3Q7p.png)