Skip to content

[python] Help with preprocess script #7

@zerox1212

Description

@zerox1212

Does someone have an idea why this script works from API Docs, but not from an actual API call (in my case from Android)

API_KEY = 'xxxxxxxxxxxxxxxxxx'

payload = event.request.payload

if payload:
    if 'first_name' not in payload:
        raise ValueError('User name field missing')
    
user_name = payload.first_name

if user_name == '':
    raise ValueError('User name field required')

response = platform.api.get('system/user?api_key=' + API_KEY + '&filter=first_name%3D' + user_name)
response_string = response.read().decode('utf-8')
response_bunch = bunchify(json.loads(response_string))

if response_bunch.resource:
    raise ValueError('User name is not available')

From API docs it works as expected. If a first name is taken, it says "user name not available". If there are no issues the user is registered as normal.

Calling from my Android app I always get the same response if this script is active.
{"error":{"context":null,"message":"resource","code":500,"trace":[....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions