import json

import requests


def simple(conf):
    url = conf['url']
    output_format = conf.get('format', 'html')
    response = requests.get(url)
    if output_format == 'json':
        return json.dumps(response.json(), indent=True)
    else:
        return response.text

import json

import requests


def simple(conf):
    url = conf['url']
    output_format = conf.get('format', 'html')
    response = requests.get(url)
    if output_format == 'json':
        return json.dumps(response.json(), indent=True, sort_keys=True)
    else:
        return response.text

Sort keys in JSON fetcher for consistent results
Sort keys in JSON fetcher for consistent results
  import json
  
  import requests
  
  
  def simple(conf):
      url = conf['url']
      output_format = conf.get('format', 'html')
      response = requests.get(url)
      if output_format == 'json':
-         return json.dumps(response.json(), indent=True)
+         return json.dumps(response.json(), indent=True, sort_keys=True)
      else:
          return response.text
  
Sort keys in JSON fetcher for consistent results
## Code Before:
import json

import requests


def simple(conf):
    url = conf['url']
    output_format = conf.get('format', 'html')
    response = requests.get(url)
    if output_format == 'json':
        return json.dumps(response.json(), indent=True)
    else:
        return response.text

## Instruction:
Sort keys in JSON fetcher for consistent results
## Code After:
import json

import requests


def simple(conf):
    url = conf['url']
    output_format = conf.get('format', 'html')
    response = requests.get(url)
    if output_format == 'json':
        return json.dumps(response.json(), indent=True, sort_keys=True)
    else:
        return response.text
