How to connect VSTS through Python by VSTS personal token to query and fetch the query results
To connect Azure Devops through Python by VSTS personal token, you can use following connection code:
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint
# Fill in with your personal access token and org URL
personal_access_token = 'YOURPAT'
organization_url = 'https://dev.azure.com/YOURORG'
# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
Check the document Azure DevOps Python API for some more details.
And if want to uery and fetch the query results with Python REST API, you can refer to this thread.
Besides, since you do not share the detailed info about your code you tried and what not worked, I could not give you an accurate answer, but MS provide some samples how to use the Python REST API:
Python samples for Azure DevOps
Hope this helps.