input: Write a python function to read temperature and humidity from a DHT11 sensor and send the data to a specified URL.
  assert read_and_send_data('http://mydatabase.url/api/data', 23) != "Failed to get reading. Try again!"
  assert isinstance(read_and_send_data('http://anotherdatabase.url/api/data', 23), dict)
  assert 'temperature' in read_and_send_data('http://yetanotherdatabase.url/api/data', 23)
  assert 'humidity' in read_and_send_data('http://yetanotherdatabase.url/api/data', 23)
output: import Adafruit_DHT
  import requests
  
  def read_and_send_data(url, pin):
      # Sensor type and pin number
      sensor = Adafruit_DHT.DHT11
  
      # Read temperature and humidity from the sensor
      humidity, temperature = Adafruit_DHT.read(sensor, pin)
  
      if humidity is None or temperature is None:
          return "Failed to get reading. Try again!"
  
      # Prepare data to be sent
      data = {
          'temperature': temperature,
          'humidity': humidity
      }
  
      # Send data to the specified URL
      response = requests.post(url, json=data)
  
      # Check if the request was successful
      if response.status_code == 200:
          return data
      else:
          return "Failed to send data."