Skip to content

Commit

Permalink
fix jql requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredmixpanel committed Feb 23, 2022
1 parent 2fdf521 commit 61185de
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,13 @@ def request(
headers["Authorization"] = f"Basic {encoded_credentials}"

# Set up request url and body based on HTTP method and endpoint
if self.service_account_username:
params['project_id'] = self.project_id
if method == "GET" or method == "DELETE":
data = None
if self.service_account_username:
params['project_id'] = self.project_id
request_url += "?" + MixpanelUtils._unicode_urlencode(params)
else:
if "engage" in path_components:
data = MixpanelUtils._unicode_urlencode(params).encode("utf-8")
request_url += "?verbose=1"
else:
if "import" in path_components:
headers["Content-Type"] = "application/json"
data = params["data"]
query_params = {}
Expand All @@ -252,6 +249,10 @@ def request(
query_params["project_id"] = self.project_id
if query_params:
request_url += "?" + MixpanelUtils._unicode_urlencode(query_params)
else:
data = MixpanelUtils._unicode_urlencode(params).encode("utf-8")
if "engage" in path_components:
request_url += "?verbose=1"
# Uncomment the line below to debug log the request body data
# MixpanelUtils.LOGGER.debug(f"{method} data: {data}")
MixpanelUtils.LOGGER.debug(f"Request Method: {method}")
Expand Down

0 comments on commit 61185de

Please sign in to comment.