title: Automatically change data in query API with python using requests
body: <p>I'm using an API to get some date (see code below) and everything works fine so far.</p>
  <pre><code>import requests
  import pandas as pd
  
  headers = {'content-type': 'application/json'}
  query = &quot;&quot;&quot;
  query Dataset 
  {
      elspotprices
      (
          where:
          {
              HourUTC: {_gt: \&quot;2021-09-30\&quot;}
              PriceArea: {_eq: \&quot;DK2\&quot;}
          }
          order_by: 
          {
              HourUTC: asc
          } 
          offset:0
      )
      {   
          SpotPriceDKK
      }
  }
  &quot;&quot;&quot;
  request = requests.post('https://data-api.energidataservice.dk/v1/graphql', json={&quot;query&quot;:query}, headers=headers)
  data = request.json()['data']['elspotprices']
  spotprices_df = pd.DataFrame(data)
  </code></pre>
  <p>However, I would like to define my variable <strong>date</strong> that represents any day and automatically change also the query string (an example of code is shown below which <strong>doesn't work</strong>) where the HourUTC is specified.</p>
  <pre><code>import requests
  import pandas as pd
  
  date = &quot;2021-09-30\&quot;
  
  headers = {'content-type': 'application/json'}
  query = &quot;&quot;&quot;
  query Dataset 
  {
      elspotprices
      (
          where:
          {
              HourUTC: {_gt: \date}
              PriceArea: {_eq: \&quot;DK2\&quot;}
          }
          order_by: 
          {
              HourUTC: asc
          } 
          offset:0
      )
      {   
          SpotPriceDKK
      }
  }
  &quot;&quot;&quot;
  request = requests.post('https://data-api.energidataservice.dk/v1/graphql', json={&quot;query&quot;:query}, headers=headers)
  data = request.json()['data']['elspotprices']
  spotprices_df = pd.DataFrame(data)
  </code></pre>
  <p>Unfortunately, I didn't find the right way to do it yet but I'm pretty sure that there should be a way to do it.</p>