Dec-10-2024, 10:05 PM
Hello everyone,
I have a function that connects to an API and get data and needs 3 parameters, all string, but one of them is a GUID. So I validated what data type is the GUID coming with, and it is "text", but still get the error about mixing data types. Here is what the debugger returned when validating the data types which also shows the error message.
[attachment=3142]
is how I define the function inside my views.py file:
def GetRepoBranches(Org, Prj, RepoID):
URI = (f"https://dev.azure.com/{Org}/{Prj}/_apis/git/repositories/{RepoID}/refs")
return (requests.get(URI, userauth)).json()
To test the URI constructed in the function, I used PostMan and it worked ok (See attachment to view the whole URI).
[attachment=3141]
The interesting thing is, when I run the following code without using the function, and passing the same values when building the URI, it works ok:
URI = (f"https://dev.azure.com/{Org}/{Prj}/_apis/git/repositories/{r['id']}/refs")
refsDetails = (requests.get(URI, auth=userauth)).json()
So, I do not know why I am getting that error when using the function. Any help would be greatly appreciated.
Thanks
NG
I have a function that connects to an API and get data and needs 3 parameters, all string, but one of them is a GUID. So I validated what data type is the GUID coming with, and it is "text", but still get the error about mixing data types. Here is what the debugger returned when validating the data types which also shows the error message.
[attachment=3142]
is how I define the function inside my views.py file:
def GetRepoBranches(Org, Prj, RepoID):
URI = (f"https://dev.azure.com/{Org}/{Prj}/_apis/git/repositories/{RepoID}/refs")
return (requests.get(URI, userauth)).json()
To test the URI constructed in the function, I used PostMan and it worked ok (See attachment to view the whole URI).
[attachment=3141]
The interesting thing is, when I run the following code without using the function, and passing the same values when building the URI, it works ok:
URI = (f"https://dev.azure.com/{Org}/{Prj}/_apis/git/repositories/{r['id']}/refs")
refsDetails = (requests.get(URI, auth=userauth)).json()
So, I do not know why I am getting that error when using the function. Any help would be greatly appreciated.
Thanks
NG