devopshq / tfs

Microsoft TFS API Python client
https://devopshq.github.io/tfs/
MIT License
110 stars 28 forks source link

support of TFS2010? #91

Closed yingang closed 3 years ago

yingang commented 3 years ago

Trying to automate some daily TFS operations with dohq-tfs, the code is like:

user = input('user:')
pwd = getpass.getpass('password:')
client = TFSAPI('http://tfs/tfs/', project='DefaultCollection/xxx', user=user, password=pwd)
workitem = client.get_workitem(64656)
print(workitem.field_names)

Which gives:

File "d:\Utilities\tfs_utility\venv\lib\site-packages\tfs\connection.py", line 122, in get_workitems work_items_batch_info = self.get_workitems(work_items_batch, fields=fields, expand=expand) File "d:\Utilities\tfs_utility\venv\lib\site-packages\tfs\connection.py", line 103, in get_workitems workitems = self.get_tfs_resource( File "d:\Utilities\tfs_utility\venv\lib\site-packages\tfs\connection.py", line 50, in get_tfs_resource raw = self.get_json(uri=uri, underProject=underProject, payload=payload) File "d:\Utilities\tfs_utility\venv\lib\site-packages\tfs\connection.py", line 79, in get_json return self.rest_client.send_get(uri, payload=payload, project=underProject) File "d:\Utilities\tfs_utility\venv\lib\site-packages\tfs\connection.py", line 453, in send_get return self.send_request('GET', uri, None, payload=payload, underProject=project, json=json) File "d:\Utilities\tfs_utility\venv\lib\site-packages\tfs\connection.py", line 506, in send_request response.raise_for_status() File "d:\Utilities\tfs_utility\venv\lib\site-packages\requests\models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://tfs/tfs/DefaultCollection/_apis/wit/workitems?ids=64656&$expand=all&api-version=1.0

Don't know where the url comes from. If I put the url into the browser, it would prompt me to input user/pwd and then the page would become blank (without any info/error). Is it possible related with TFS 2010 we are using?

Any suggestion would be greatly appreciated.

Update: just found the compatibility statement on the homepage, looks like it only support TFS 2015+, sad...