Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(34)  |  Call(34)  |  Derive(0)  |  Import(0)

src/s/f/sftmumblebot-HEAD/MumbleConnection.py   sftmumblebot(Download)
	def _openConnection(self):
		s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		s.connect((self._hostname, self._port))
		try:
			self._log("trying python default ssl socket", 3)
				s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
				s.connect((self._hostname, self._port))
				self._log("python default ssl connection failed, trying TLSv1", 3)
				self._socket = ssl.wrap_socket(s, ssl_version = ssl.PROTOCOL_TLSv1)
			except ssl.SSLError:
			pbMess = messagetype()
		except:
			self._log("unknown package id: " + str(mid), 1)
			return True
 
				pbMess.ParseFromString(data)
			except:
				self._log("message could not be parsed corerctly, message type: "+messagetype.__name__, 1)
				return True
 
		# handle the message.
		if messagetype == Mumble_pb2.ServerSync:
			self._log("server sync package received. session=" + str(pbMess.session), 1)

src/s/f/sftmumblebot-HEAD/IRCConnection.py   sftmumblebot(Download)
				iline = line.decode(self._encoding, errors='ignore')
			except:
				self._log("received a line which is not valid " + self._encoding + ": " + repr(iline), 1)
			line = iline
			self._log("rx: "+line, 3)
	def _sendMessageUnsafe(self, message):
		self._log("tx: " + message, 3)
		try:
			self._socket.send(message.encode(self._encoding, errors='ignore') + "\n")
		except Exception as e:
			self._log("failed sending %s: " % (message) + str(e), 1)
	def setAway(self, message=None):
		if not self._established:
			self._log("can't set IRC away status since connection not established", 1)
			return False
 

src/s/f/sftmumblebot-HEAD/ConsoleConnection.py   sftmumblebot(Download)
	def _listen(self):
		try:
			line = sys.stdin.readline()
		except KeyboardInterrupt:
			self._log("keyboard interrupt", 1)
			uline = line.decode(self._encoding)
		except:
			self._log("decoding the line using the default encoding " + self._encoding + " has failed.", 1)
			try:
				uline = line.decode('utf-8')
			except:
				self._log("decoding the line using utf-8 has failed.", 1)
					uline = line.decode('latin-1')
				except:
					self._log("decoding the line using latin-1 has failed. trying errors='ignore' from now on.", 1)
					try:
						uline = line.decode('utf-8', errors='ignore')
					except:
						self._log("how the fuck did you manage to crash line.decode('utf-8', errors='ignore')? now if decode('ascii', errors='ignore') fails, it's clearly your fault.", 1)