19 Sept 2016, 17:03

@PenPen: I am sorry for this way too late answer. Not sure if you need an answer anymore

Here is an example with GPIO pin 14 for controlling the fan. The indents might not be correct 😉 I had a little trouble with copy/paste the code 😄
Hope I can help you with this

#!/usr/bin/env python

import os
import time
import RPi.GPIO as GPIO

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
#Set max. temperature of CPU
TEMP_MAX = 67
ON_TIME = 200
#Set pin 14 as transistor gate
GATE = 14
#Set pin 14 as an output and shut down
GPIO.setup(GATE, GPIO.OUT)
GPIO.output(GATE, False)

def getCPUtemperature():
	 res = os.popen('vcgencmd measure_temp').readline()
	return(res.replace("temp=","").replace("'C\n",""))

while True:

		temp_float = float(getCPUtemperature())

	try:
		if (temp_float > TEMP_MAX):
			# ein
			GPIO.output(GATE, True)
			time.sleep(ON_TIME)
			# aus
			GPIO.output(GATE, False)
		else:
			GPIO.output(GATE, False)
		
except KeyboardInterrupt:
	print float(getCPUtemperature())
	print "power off fan..."
	GPIO.output(GATE, False)
	print "cancelling..."

Forgot to attach a short drawing. I used the official RaspberryPI 5V DC fan.

0_1474305851135_Unbenannt.PNG