8000 RequestOptions Filter does not properly escape strings. · Issue #418 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

RequestOptions Filter does not properly escape strings. #418

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

Closed
1oglop1 opened this issue Apr 3, 2019 · 2 comments
Closed

RequestOptions Filter does not properly escape strings. #418

1oglop1 opened this issue Apr 3, 2019 · 2 comments
Labels

Comments

@1oglop1
Copy link
1oglop1 commented Apr 3, 2019

Hi, I tried to find user by user name using request options however I still got errors until I tried to quote_plus the user name string.

Task:

Find user via user name
username=1oglop1+24@gmail.com

Steps

import tableauserverclient as tsc
# .. server sign in etc..
request_options = tsc.RequestOptions()
request_options.filter.add(
    tsc.Filter(
        tsc.RequestOptions.Field.Name, 
        tsc.RequestOptions.Operator.Equals, 
        '1oglop1+24@gmail.com'
        )
)
users, pagination_item = server.users.get(request_options)
print(users)

Expected result

[<User ada95cbc-ca59-4087-bbfe-acbcf55d88a4 name=1oglop1+24@gmail.com role=Creator>]

Actual result

[]

This is due to the character + in username.
I'm using quote_plus as a workaround.

import tableauserverclient as tsc
from urllib.parse import quote_plus
# .. server sign in etc..
request_options = tsc.RequestOptions()
request_options.filter.add(
    tsc.Filter(
        tsc.RequestOptions.Field.Name,
        tsc.RequestOptions.Operator.Equals,
        quote_plus('1oglop1+24@gmail.com')
        )
)
users, pagination_item = server.users.get(request_options)
print(users)
# [<User ada95cbc-ca59-4087-bbfe-acbcf55d88a4 name=1oglop1+24@gmail.com role=Creator>]
@rhelenius
Copy link

Quote plus worked for me as well except for when the % character is present.

@jacalata
Copy link
Contributor

This works today

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

3 participants
0