title: How do I write a graphQL mutation in a python function?
body: <p>I want to create a python function of a simple graphQL mutation. I have a graphQL schema and there is a mutation to delete an object by giving its ID.
  GraphQL docs shows :</p>
  <pre><code>delete(
  id: ID!
  ): Boolean!
  </code></pre>
  <p>To delete the object using the global ID I tried creating a python function but I am getting a syntax error of graphQL which I am not able to figure out.</p>
  <pre><code>#function to delete FIB
  def deleteObj(self,id): # returns FIB deletion boolean
      
          objDel = self.graphQLClient.fetch(&quot;&quot;&quot;
              mutation delete($id: [ID!]!) {
                  delete(id: $id,) {
                      id
                  }
              }
          &quot;&quot;&quot;, {
              'id': id ,
              
          })
          info('***Object deletion result %s\n' % objDel)
  </code></pre>
  <p>I am able to understand I am doing some silly mistake but an explanation would help me in the future.</p>
  <p>Error I am getting is:</p>
  <blockquote>
  <p>fib deletion result {'data': None, 'errors': [{'message': 'Syntax
  Error GraphQL request (3:34) Unexpected empty IN {}\n\n2:<br />
  mutation delete($id: [ID!]!) {\n3:                 delete(id: $id,)
  {\n                                    ^\n4:     \n', 'locations':
  [{'line': 3, 'column': 34}]}]}</p>
  </blockquote>
  <p>I am able to insert an object using mutation something like this:</p>
  <pre><code>def insertFibEntry(self, prefix, name): # returns FIB entry ID
          
          fib = self.graphQLClient.fetch(&quot;&quot;&quot;
              mutation insertFibEntry($name: Name!, $nexthops: [ID!]!) {
                  insertFibEntry(name: $name, nexthops: $nexthops) {
                      id
                  }
              }
          &quot;&quot;&quot;, {
              'name': &quot;/&quot;+prefix ,
              'nexthops': [self.faces[name]['data']['createFace']['id']]
              
          })
          info('***fib result %s\n' % fib)
          info('***prefix is %s'% &quot;'/&quot;+prefix+&quot;'&quot;+ '\n')
  </code></pre>