The answer is yes.
It seems that only non-latin usernames have problems in my case.
(This api_key was immediately revoked by me, so there is no problem with leaking it.)
The answer is yes.
It seems that only non-latin usernames have problems in my case.
(This api_key was immediately revoked by me, so there is no problem with leaking it.)
I’m curious to know if this particular site is installed in a different manner, perhaps another proxy in front of it?
It is indeed behind the proxy. I’m not sure, maybe that had an impact?
I suspect the proxy may be the cause.
Can you send the request direct to the real server’s IP and see what result you get back?
That’ll let us know if it’s Cloudflare interfering.
I tried and seems not working for me either
if applying .encode()
to the chinese characters username, or urllib.parse.quote()
headers = {
'Api-Key': API_KEY,
'Api-Username': '大帅哥'.encode()
}
# or urllib parse
headers = {
'Api-Key': API_KEY,
'Api-Username': urllib.parse.quote(API_USERNAME)
}
I will get error
Failed to create post. Status code: 403
{'errors': ['您没有权限查看请求的资源。API 用户名或者密钥无效。'], 'error_type': 'invalid_access'}
but, without .encode()
headers = {
'Api-Key': API_KEY,
'Api-Username': '大帅哥'
}
I will get error
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-2: ordinal not in range(256)
also tried to create user name just use the encoded string "username": "\xe5\xa4\xa7\xe5\xb8\x85\xe5\x93\xa5"
, but seems not working either as it’s not decoded properly I guess
What language and language version?
it’s chinese characters
not sure how to check the language version tho…
thanks Michael
Those questions were about the programming language