Quick help on how to get going with Python?

Options

Hi all,

I'm a beginner when it comes to coding, and I've never used the TeamViewer API before.

Could someone help me just to get started with the API in Python, and show me some code example on how to lets say create / list all sessions?

I created an app, and got a client id and client secret.

Here's a little sample:

 

import requests

client_id = 'XXXX-XXXXXXXX'
clientt_secret = 'XXXXXXXXXXXX

url='base_url ='https://webapi.teamviewer.com/api/v1/'

headers = {"content-type": "application/json", "Authorization": "Bearer "+client_id}

test = requests.get(base_url+'sessions', headers=headers)

All I get is <Response [401]>.

If someone could provide a short example just to get my going, that would have been great.

Comments