[GH-ISSUE #2452] [bug]: Incorrect parsing Python code #830

Closed
opened 2026-03-16 17:21:03 +03:00 by kerem · 4 comments
Owner

Originally created by @karoldem on GitHub (Jun 23, 2022).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2452

Originally assigned to: @aitchnyu on GitHub.

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

messes up quotations:

"sec-ch-ua-platform": ""Windows"",

should be:

"sec-ch-ua-platform": '"Windows"',

import requests

url = "https://apus-api.theprotocol.it/offers/_search"

querystring = {"pageNumber":"1","orderby.field":"MaxSalary"}

payload = {
  "typesOfContractIds": [],
  "positionLevelIds": [1, 3, 17],
  "cities": ["Warszawa"],
  "workModeCodes": [],
  "onlyWithProjectDescription": False,
  "technologies": [],
  "regionsOfWorld": [],
  "keywords": [],
  "specializations": [],
  "isSupportingUkraine": False
}
headers = {
  "content-type": "application/json",
  "authority": "apus-api.theprotocol.it",
  "accept": "application/json, text/plain, */*",
  "accept-language": "pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7,en-GB;q=0.6",
  "cookie": "dtCookie=v_4_srv_1_sn_E690AF12C2E49D82A5A8E2D8C938D5E8_perc_100000_ol_0_mul_1_app-3A4e5d59da394b8ec1_1; gptrackCookie=cef1bbd7-ab07-43fa-y292-7ad9350b5d84; _stemantiforgery=CfDJ8DZBBGHonWdFl9_Em-lmm7xOQSM3tA3G-q-Py0lp0ceEaUY3Ga8gq-pcUIxAtvVNbgaVDVpMfwT7uapZczdkr6K9q99buBcLoJIy1OmAO6zgiZedvDqXKGUguUnpq8zUOut8RLClyuoat7mUTHJ6Lgk; _gcl_au=1.1.376046661.1655855987; pvid=5e2bd363-1f28-45bf-y77b-de7ebc7e4413; XSRF-TOKEN=CfDJ8DZBBGHonWdFl9_Em-lmm7zRbPnQ60z-rQZqqankI0CVSwikgVTUvkUuzt7f7iitJWfIZf6s1tCj19MlnDA-YWLKTTnIeX9qRoMFl3DVCw8y37BEaYa17DUm5f_KHKiOkWZHyaOtiBdUKmAhE0o7-dk",
  "origin": "https://theprotocol.it",
  "referer": "https://theprotocol.it/filtry/trainee,assistant,junior;p/warszawa;wp/praca/java-developer,oferta,89a00000-8461-0e50-efc3-08da4dd68236?sort=salary",
  "sec-ch-ua": "" Not A;Brand";v="99", "Chromium";v="101", "Opera";v="87"",
  "sec-ch-ua-mobile": "?0",
  "sec-ch-ua-platform": ""Windows"",
  "sec-fetch-dest": "empty",
  "sec-fetch-mode": "cors",
  "sec-fetch-site": "same-site",
  "user-agent": "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 OPR/87.0.4390.45",
  "x-application-name": "theprotocol-it",
  "x-application-version": "4.4.139",
  "x-xsrf-token": "CfDJ8DZBBGHonWdFl9_Em-lmm7zRbPnQ60z-rQZqqankI0CVSwikgVTUvkUuzt7f7iitJWfIZf6s1tCj19MlnDA-YWLKTTnIeX9qRoMFl3DVCw8y37BEaYa17DUm5f_KHKiOkWZHyaOtiBdUKmAhE0o7-dk"
}

response = requests.request("POST", url, json=payload, headers=headers, params=querystring)

print(response.text)

should be:

import requests

url = "https://apus-api.theprotocol.it/offers/_search"

querystring = {"pageNumber":"1","orderby.field":"MaxSalary"}

payload = {
  "typesOfContractIds": [],
  "positionLevelIds": [1, 3, 17],
  "cities": ["Warszawa"],
  "workModeCodes": [],
  "onlyWithProjectDescription": False,
  "technologies": [],
  "regionsOfWorld": [],
  "keywords": [],
  "specializations": [],
  "isSupportingUkraine": False
}
headers = {
  "content-type": "application/json",
  "authority": "apus-api.theprotocol.it",
  "accept": "application/json, text/plain, */*",
  "accept-language": "pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7,en-GB;q=0.6",
  "cookie": "dtCookie=v_4_srv_1_sn_E690AF12C2E49D82A5A8E2D8C938D5E8_perc_100000_ol_0_mul_1_app-3A4e5d59da394b8ec1_1; gptrackCookie=cef1bbd7-ab07-43fa-y292-7ad9350b5d84; _stemantiforgery=CfDJ8DZBBGHonWdFl9_Em-lmm7xOQSM3tA3G-q-Py0lp0ceEaUY3Ga8gq-pcUIxAtvVNbgaVDVpMfwT7uapZczdkr6K9q99buBcLoJIy1OmAO6zgiZedvDqXKGUguUnpq8zUOut8RLClyuoat7mUTHJ6Lgk; _gcl_au=1.1.376046661.1655855987; pvid=5e2bd363-1f28-45bf-y77b-de7ebc7e4413; XSRF-TOKEN=CfDJ8DZBBGHonWdFl9_Em-lmm7zRbPnQ60z-rQZqqankI0CVSwikgVTUvkUuzt7f7iitJWfIZf6s1tCj19MlnDA-YWLKTTnIeX9qRoMFl3DVCw8y37BEaYa17DUm5f_KHKiOkWZHyaOtiBdUKmAhE0o7-dk",
  "origin": "https://theprotocol.it",
  "referer": "https://theprotocol.it/filtry/trainee,assistant,junior;p/warszawa;wp/praca/java-developer,oferta,89a00000-8461-0e50-efc3-08da4dd68236?sort=salary",
  "sec-ch-ua": '" Not A;Brand";v="99", "Chromium";v="101", "Opera";v="87"',
  "sec-ch-ua-mobile": "?0",
  "sec-ch-ua-platform": '"Windows"',
  "sec-fetch-dest": "empty",
  "sec-fetch-mode": "cors",
  "sec-fetch-site": "same-site",
  "user-agent": "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 OPR/87.0.4390.45",
  "x-application-name": "theprotocol-it",
  "x-application-version": "4.4.139",
  "x-xsrf-token": "CfDJ8DZBBGHonWdFl9_Em-lmm7zRbPnQ60z-rQZqqankI0CVSwikgVTUvkUuzt7f7iitJWfIZf6s1tCj19MlnDA-YWLKTTnIeX9qRoMFl3DVCw8y37BEaYa17DUm5f_KHKiOkWZHyaOtiBdUKmAhE0o7-dk"
}

response = requests.request("POST", url, json=payload, headers=headers, params=querystring)

print(response.text)

Steps to reproduce

Generate Python code

Environment

Production

Version

Cloud

Originally created by @karoldem on GitHub (Jun 23, 2022). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2452 Originally assigned to: @aitchnyu on GitHub. ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior messes up quotations: ` "sec-ch-ua-platform": ""Windows"",` should be: ` "sec-ch-ua-platform": '"Windows"',` ``` import requests url = "https://apus-api.theprotocol.it/offers/_search" querystring = {"pageNumber":"1","orderby.field":"MaxSalary"} payload = { "typesOfContractIds": [], "positionLevelIds": [1, 3, 17], "cities": ["Warszawa"], "workModeCodes": [], "onlyWithProjectDescription": False, "technologies": [], "regionsOfWorld": [], "keywords": [], "specializations": [], "isSupportingUkraine": False } headers = { "content-type": "application/json", "authority": "apus-api.theprotocol.it", "accept": "application/json, text/plain, */*", "accept-language": "pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7,en-GB;q=0.6", "cookie": "dtCookie=v_4_srv_1_sn_E690AF12C2E49D82A5A8E2D8C938D5E8_perc_100000_ol_0_mul_1_app-3A4e5d59da394b8ec1_1; gptrackCookie=cef1bbd7-ab07-43fa-y292-7ad9350b5d84; _stemantiforgery=CfDJ8DZBBGHonWdFl9_Em-lmm7xOQSM3tA3G-q-Py0lp0ceEaUY3Ga8gq-pcUIxAtvVNbgaVDVpMfwT7uapZczdkr6K9q99buBcLoJIy1OmAO6zgiZedvDqXKGUguUnpq8zUOut8RLClyuoat7mUTHJ6Lgk; _gcl_au=1.1.376046661.1655855987; pvid=5e2bd363-1f28-45bf-y77b-de7ebc7e4413; XSRF-TOKEN=CfDJ8DZBBGHonWdFl9_Em-lmm7zRbPnQ60z-rQZqqankI0CVSwikgVTUvkUuzt7f7iitJWfIZf6s1tCj19MlnDA-YWLKTTnIeX9qRoMFl3DVCw8y37BEaYa17DUm5f_KHKiOkWZHyaOtiBdUKmAhE0o7-dk", "origin": "https://theprotocol.it", "referer": "https://theprotocol.it/filtry/trainee,assistant,junior;p/warszawa;wp/praca/java-developer,oferta,89a00000-8461-0e50-efc3-08da4dd68236?sort=salary", "sec-ch-ua": "" Not A;Brand";v="99", "Chromium";v="101", "Opera";v="87"", "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": ""Windows"", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-site", "user-agent": "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 OPR/87.0.4390.45", "x-application-name": "theprotocol-it", "x-application-version": "4.4.139", "x-xsrf-token": "CfDJ8DZBBGHonWdFl9_Em-lmm7zRbPnQ60z-rQZqqankI0CVSwikgVTUvkUuzt7f7iitJWfIZf6s1tCj19MlnDA-YWLKTTnIeX9qRoMFl3DVCw8y37BEaYa17DUm5f_KHKiOkWZHyaOtiBdUKmAhE0o7-dk" } response = requests.request("POST", url, json=payload, headers=headers, params=querystring) print(response.text) ``` should be: ``` import requests url = "https://apus-api.theprotocol.it/offers/_search" querystring = {"pageNumber":"1","orderby.field":"MaxSalary"} payload = { "typesOfContractIds": [], "positionLevelIds": [1, 3, 17], "cities": ["Warszawa"], "workModeCodes": [], "onlyWithProjectDescription": False, "technologies": [], "regionsOfWorld": [], "keywords": [], "specializations": [], "isSupportingUkraine": False } headers = { "content-type": "application/json", "authority": "apus-api.theprotocol.it", "accept": "application/json, text/plain, */*", "accept-language": "pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7,en-GB;q=0.6", "cookie": "dtCookie=v_4_srv_1_sn_E690AF12C2E49D82A5A8E2D8C938D5E8_perc_100000_ol_0_mul_1_app-3A4e5d59da394b8ec1_1; gptrackCookie=cef1bbd7-ab07-43fa-y292-7ad9350b5d84; _stemantiforgery=CfDJ8DZBBGHonWdFl9_Em-lmm7xOQSM3tA3G-q-Py0lp0ceEaUY3Ga8gq-pcUIxAtvVNbgaVDVpMfwT7uapZczdkr6K9q99buBcLoJIy1OmAO6zgiZedvDqXKGUguUnpq8zUOut8RLClyuoat7mUTHJ6Lgk; _gcl_au=1.1.376046661.1655855987; pvid=5e2bd363-1f28-45bf-y77b-de7ebc7e4413; XSRF-TOKEN=CfDJ8DZBBGHonWdFl9_Em-lmm7zRbPnQ60z-rQZqqankI0CVSwikgVTUvkUuzt7f7iitJWfIZf6s1tCj19MlnDA-YWLKTTnIeX9qRoMFl3DVCw8y37BEaYa17DUm5f_KHKiOkWZHyaOtiBdUKmAhE0o7-dk", "origin": "https://theprotocol.it", "referer": "https://theprotocol.it/filtry/trainee,assistant,junior;p/warszawa;wp/praca/java-developer,oferta,89a00000-8461-0e50-efc3-08da4dd68236?sort=salary", "sec-ch-ua": '" Not A;Brand";v="99", "Chromium";v="101", "Opera";v="87"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": '"Windows"', "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-site", "user-agent": "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 OPR/87.0.4390.45", "x-application-name": "theprotocol-it", "x-application-version": "4.4.139", "x-xsrf-token": "CfDJ8DZBBGHonWdFl9_Em-lmm7zRbPnQ60z-rQZqqankI0CVSwikgVTUvkUuzt7f7iitJWfIZf6s1tCj19MlnDA-YWLKTTnIeX9qRoMFl3DVCw8y37BEaYa17DUm5f_KHKiOkWZHyaOtiBdUKmAhE0o7-dk" } response = requests.request("POST", url, json=payload, headers=headers, params=querystring) print(response.text) ``` ### Steps to reproduce Generate Python code ### Environment Production ### Version Cloud
kerem 2026-03-16 17:21:03 +03:00
Author
Owner

@aitchnyu commented on GitHub (Aug 24, 2022):

Looks like this was fixed in upcoming version of upstream package httpsnippet. @AndrewBastin shall we wait till they release new version?

<!-- gh-comment-id:1225466084 --> @aitchnyu commented on GitHub (Aug 24, 2022): Looks like this was fixed in [upcoming version](https://github.com/Kong/httpsnippet/commit/bf019b3c891e14c4b8437ed67322252a2c995ac3) of upstream package httpsnippet. @AndrewBastin shall we wait till they release new version?
Author
Owner

@AndrewBastin commented on GitHub (Aug 24, 2022):

@aitchnyu yup. we will wait for that update to be live and then close this.

<!-- gh-comment-id:1225617658 --> @AndrewBastin commented on GitHub (Aug 24, 2022): @aitchnyu yup. we will wait for that update to be live and then close this.
Author
Owner

@liyasthomas commented on GitHub (Oct 3, 2022):

Closed by mistake, reopening.

<!-- gh-comment-id:1265179104 --> @liyasthomas commented on GitHub (Oct 3, 2022): Closed by mistake, reopening.
Author
Owner

@liyasthomas commented on GitHub (Aug 31, 2023):

Thanks for your patience and valuable feedback. This issue has been resolved in latest release.

Closing this ticket as the fix is now available in the recent version. Feel free to reach out if you encounter any further concerns.

<!-- gh-comment-id:1701534763 --> @liyasthomas commented on GitHub (Aug 31, 2023): Thanks for your patience and valuable feedback. This issue has been resolved in latest release. Closing this ticket as the fix is now available in the recent version. Feel free to reach out if you encounter any further concerns.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#830
No description provided.