Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when updating WIT field #30

Open
myksaquino opened this issue Apr 24, 2018 · 1 comment
Open

Error when updating WIT field #30

myksaquino opened this issue Apr 24, 2018 · 1 comment
Labels

Comments

@myksaquino
Copy link

I am able to get details of a wit field using print(workitem['state'] ) but i am getting error when updating it..

I am getting below error when updating wit field:

Traceback (most recent call last):
File "C:\Python35-32\lib\site-packages\dohq_tfs-1.0.dev0-py3.5.egg\tfs\connection.py", line 224, in _send_request
File "C:\Python35-32\lib\site-packages\requests-2.18.4-py3.5.egg\requests\models.py", line 892, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Python35-32\lib\json_init
.py", line 319, in loads
return _default_decoder.decode(s)
File "C:\Python35-32\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python35-32\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/Release/PythonProjects/TFSAPI.py", line 33, in
workitem['state'] = 'Pending Review'
File "C:\Python35-32\lib\site-packages\dohq_tfs-1.0.dev0-py3.5.egg\tfs\resources.py", line 89, in setitem
File "C:\Python35-32\lib\site-packages\dohq_tfs-1.0.dev0-py3.5.egg\tfs\connection.py", line 107, in update_workitem
File "C:\Python35-32\lib\site-packages\dohq_tfs-1.0.dev0-py3.5.egg\tfs\connection.py", line 189, in send_patch
File "C:\Python35-32\lib\site-packages\dohq_tfs-1.0.dev0-py3.5.egg\tfs\connection.py", line 231, in __send_request
tfs.connection.TFSClientError: Response is not json: Invalid Http Request Header

@myksaquino
Copy link
Author

tried debugging and it seems the first try to send request is failing. Then sending it again, i am getting a successful response.

so i add a tweak on my code to send the request twice...
#this function update fields twice
def update_data(workitem, work_item_value, data):
try:
workitem[work_item_value] = data
except BaseException:
pass
workitem[work_item_value] = data

@allburov allburov removed their assignment May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants