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

Issue passing id to get_task() #9

Open
gstraderbgl opened this issue Oct 24, 2019 · 1 comment
Open

Issue passing id to get_task() #9

gstraderbgl opened this issue Oct 24, 2019 · 1 comment
Labels

Comments

@gstraderbgl
Copy link

I am making a call like this where the task_id is a GUID such as 3bc13721-d21c-47b7-b99b-da05cd91b8d0.

task = qrs.get_task(filterparam="id eq", filtervalue=task_id)

I receive a runtime error as follows.
File "C:\software\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Debugging the script, I see that session.get() is called on line 137 of qrspy.py, and a request is made to the server. The response that is returned is a 400 error:
b'Cannot convert the constant value "Guid" to the following: '3bc13721-d21c-47b7-b99b-da05cd91b8d0''

In reviewing the QRS API documentation, it appears that you're not supposed to quote GUIDs. I removed the single quotes around {3} on line 137 of qrspy.py, and the request to the API returns the correct results. Is this a bug or am I doing it wrong? In your examples only name parameters are passed, not GUIDs.

Non-working code for GUIDs:
Line 137: response = session.get("https://{0}/{1}?filter={2} '{3}'&xrfkey={4}".format

Non-working example request for GUIDs:
"https://bgl-gs-w540:4242/qrs/task?filter=id%20eq%20'3bc13721-d21c-47b7-b99b-da05cd91b8d0'&xrfkey=2W8Ia1QjtfK6C9XU"

Working code for GUIDs:
response = session.get("https://{0}/{1}?filter={2} {3}&xrfkey={4}".format

Working example request for GUIDs:
'https://bgl-gs-w540:4242/qrs/task?filter=id%20eq%203bc13721-d21c-47b7-b99b-da05cd91b8d0&xrfkey=ysk4tEJbah3MpSjU'

@clintcarr
Copy link
Owner

Likely a bug in QRSpy, I imagine something in the QRS has changed since the code was developed, if removing the quotes solves the issue, and doesnt prevent other functionality feel free to do a pull and I will merge. Otherwise I will test and resolve in the coming week.
Thanks for the heads up.

@clintcarr clintcarr added the bug label Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants