input: Write a function to design a web server in Python using the Flask framework that serves a JSON object containing the current temperature for a city based on the city name given in the request. The function should define an endpoint `/getTemp` which accepts POST requests with a JSON body containing the `city` key. It should return a JSON object with the `temperature` key extracted from the OpenWeatherMap API response.
  assert get_temp() is not None
  assert 'temperature' in get_temp().json()
  assert get_temp().status_code == 200
output: 
  def get_temp():
      from flask import Flask, request, jsonify
      import requests
  
      app = Flask(__name__)
  
      @app.route('/getTemp', methods=['POST'])
      def get_temp():
          city = request.json.get('city')
          if not city:
              return jsonify({'error': 'City name is required'}), 400
          
          api_key = 'your_openweathermap_api_key'
          url = f'http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric'
          response = requests.get(url)
          
          if response.status_code != 200:
              return jsonify({'error': 'City not found'}), 404
          
          data = response.json()
          temperature = data['main']['temp']
          return jsonify({'temperature': temperature}), 200
  
      return app.test_client().post('/getTemp', json={'city': 'London'})
  