Question

I am working on a script in Python that will call the JQL script. How do I go about this?

curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/search?jql=assignee=fred+order+by+duedate

Assume the above is the JQL query.

This is what I have so far but it's getting an "invalid syntax" error.

from grt import executeScript

querystring = "curl -D- -u fred:fred -X GET -H "Content-Type: application/json"      http://kelpie9:8081/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key"
executeScript(querystring)

This is my error:

      File "/home/.spyder2/temp.py", line 19
    querystring = "curl -D- -u fred:fred -X GET -H "Content-Type: application/json"      http://kelpie9:8081/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key"
                                                      ^
SyntaxError: invalid syntax
Was it helpful?

Solution

You don't open/close the string properly:

querystring = "curl -D- -u fred:fred -X GET -H "Content-Type: application/json"      http://kelpie9:8081/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key"

should be:

querystring = """curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key"""

because the string itself contains double-quotes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top