Reputation: 58730
I generated my Python file via PHP.
import os
#state = 6f28bbc4-623a-4424-86df-76e10e82169d
#nonce = 6ff7995b-8425-4a66-bb9c-1671557e5778
cmd = 'curl -c session_cookies.txt "https://login.uat.site.be/openid/oauth/authorize?client_id=site&state=6f28bbc4-623a-4424-86df-76e10e82169d&nonce6ff7995b-8425-4a66-bb9c-1671557e5778&response_type=code&claims=%7B%22id_token%22%3A%7B%22http%3A%2F%2Fsite.be%2Fclaims%2Froles%22%3Anull%7D%7D" 2>/dev/null| curl -v -b session_cookies.txt -L -H "Content-Type: application/x-www-form-urlencoded" -v -d '[email protected]&j_password=site1' "https://login.uat.site.be/openid/login.do" 2>&1 >/dev/null | grep Location | grep code= '
os.system(cmd)
I kept getting SyntaxError: invalid syntax
. It has so many single quotes inside the double quotes, I am not sure what I did wrong. I've tried to use \'
to escape it already.
Upvotes: 1
Views: 1629
Reputation: 54283
You can see the problem directly when you look at the colors in your block code.
j_username=manager-sitelogin@gmail...
is black while the rest of the string is red, because '
before j_username
closes the string prematurely.
You can use """string"""
syntax, as in this documentation :
cmd = """curl -c session_cookies.txt "https://login.uat.site.be/openid/oauth/authorize?client_id=benu&state=6f28bbc4-623a-4424-86df-76e10e82169d&nonce6ff7995b-8425-4a66-bb9c-1671557e5778&response_type=code&claims=%7B%22id_token%22%3A%7B%22http%3A%2F%2Fsite.be%2Fclaims%2Froles%22%3Anull%7D%7D" 2>/dev/null| curl -v -b session_cookies.txt -L -H "Content-Type: application/x-www-form-urlencoded" -v -d '[email protected]&j_password=site1' "https://login.uat.site.be/openid/login.do" 2>&1 >/dev/null | grep Location | grep code= """
Upvotes: 2