Open pavank63 opened 3 years ago
are you using the python sdk? can you provide a traceback?
Yes we are using python SDK. This is the complete traceback
Traceback (most recent call last): File "/home/app/*********/releases/1629447243/******/looker_handler.py", line 116, in disable_user response = self.__looker_client.get_user_****(data['external_user_id']) File "/home/app/*********/releases/1629447243/******/looker/looker_client.py", line 100, in get_user_*** response = self.__make_request("/users/credential/embed/" + str(external_user_id), body, 'get') File "/home/app/********/releases/1629447243/****/looker/looker_client.py", line 32, in __make_request return json.loads(requests.get(self.__endpoint+url, data=body, headers=headers).text) File "/home/app/.pyenv/versions/3.6.8/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/home/app/.pyenv/versions/3.6.8/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/app/.pyenv/versions/3.6.8/lib/python3.6/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)
I don't recognize this code (e.g. self.__make_request("/users/credential/embed/" + str(external_user_id), body, 'get')
). Are you using https://pypi.org/project/looker-sdk/
We are not using https://pypi.org/project/looker-sdk/. We are using requests.get() to call the looker API and update the details
@joeldodge79 any update ?
I have a feeling there's something funky in your patch
payload (or potentially something about the existing user) and our API isn't handling it gracefully. can you supply the body payload?
This the body along with headers that we are using
body = {
'fields': 'credentials_api3,credentials_embed,credentials_email,credentials_totp,id'
}
headers = {
'Authorization': 'token ' + self.__access_token,
}
requests.get(endpoint + url, data=body, headers=headers)
Hi @pavank63, thanks for letting us know.
When you said when we try to update the users state
, can you clarify which fields you are trying to update? Are you trying to update "ui_state" or other fields? Can you provide an example of the value for "ui_state"?
For example, I am able to update first_name
using the workflow:
url = instance + '/api/4.0/users/3'
data = { "first_name": "Lannnnnnn"}
new_me = requests.patch(url, headers = headers, json = data)
Two things I noticed from your above call:
users/user_id
. We have API explorer, so I recommend checking it out to see an example of accepted json body / required params for all of the endpoints.@lanlooker we are getting the error when we try to fetch used details using "/users/credential/embed/"
endpoint. This is the payload that we are sending to the get request
This the body along with headers that we are using
body = { 'fields': 'credentials_api3,credentials_embed,credentials_email,credentials_totp,id' }
headers = { 'Authorization': 'token ' + self.__access_token, }
requests.get(endpoint + url, data=body, headers=headers)
This is also not happening every-time, it is an intermittent fault happening a lot recently
Does it sometimes work and sometimes fail for the same external_user_id
?
Hi,
For the past few days we have been getting the below error when we try to update the users state using "
/user/<looker_user_id>
" endpoint.JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError
.Looker SDK is giving incorrect data. This is also not happening every-time, it is an intermittent fault happening a lot recently
The line of code for your reference
json.loads(requests.patch(self.__endpoint + "/users/"+str(looker_user_id), data=body, headers=headers).text)
Can you please look into this