8000 feat: accept parameters for post endpoint by Udit107710 · Pull Request #850 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content
< 8000 div class="gh-header-show ">

feat: accept parameters for post endpoint #850

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

Merged
merged 7 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tableauserverclient/server/endpoint/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ def put_request(self, url, xml_request=None, content_type="text/xml"):
content_type=content_type,
)

def post_request(self, url, xml_request, content_type="text/xml"):
def post_request(self, url, xml_request, content_type="text/xml", parameters=None):
return self._make_request(
self.parent_srv.session.post,
url,
content=xml_request,
auth_token=self.parent_srv.auth_token,
content_type=content_type,
parameters=parameters,
)


Expand Down
5 changes: 3 additions & 2 deletions tableauserverclient/server/endpoint/metadata_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ def control_baseurl(self):
return "{0}/api/metadata/v1/control".format(self.parent_srv.server_address)

@api("3.5")
def query(self, query, variables=None, abort_on_error=False):
def query(self, query, variables=None, abort_on_error=False, parameters=None):
logger.info("Querying Metadata API")

url = self.baseurl

try:
Expand All @@ -67,7 +68,7 @@ def query(self, query, variables=None, abort_on_error=False):
raise InvalidGraphQLQuery("Must provide a string")

# Setting content type because post_reuqest defaults to text/xml
server_response = self.post_request(url, graphql_query, content_type="application/json")
server_response = self.post_request(url, graphql_query, content_type="application/json", parameters=parameters)
results = server_response.json()

if abort_on_error and results.get("errors", None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def delete(self, resource, rules):

for rule in rules:
for capability, mode in rule.capabilities.items():
" /permissions/groups/group-id/capability-name/capability-mode"
"/permissions/groups/group-id/capability-name/capability-mode"
url = "{0}/{1}/permissions/{2}/{3}/{4}/{5}".format(
self.owner_baseurl(),
resource.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def baseurl(self):

@api(version="2.4")
def get(self):
""" Retrieve the server info for the server. This is an unauthenticated call """
"""Retrieve the server info for the server. This is an unauthenticated call"""
try:
server_response = self.get_unauthenticated_request(self.baseurl)
except ServerResponseError as e:
Expand Down
2 changes: 1 addition & 1 deletion tableauserverclient/server/request_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_query_params(self):


class _FilterOptionsBase(RequestOptionsBase):
""" Provide a basic implementation of adding view filters to the url """
"""Provide a basic implementation of adding view filters to the url"""

def __init__(self):
self.view_filters = []
Expand Down
0