@@ -79,7 +79,7 @@ class FONA:
7979 :param bool debug: Enable debugging output.
8080
8181 """
82-
82+
8383 # Connection modes
8484 TCP_MODE = const (0 )
8585 UDP_MODE = const (1 )
@@ -290,7 +290,9 @@ def _set_gprs(self, gprs_on=True):
290290 return False
291291
292292 # disconnect all sockets
293- if not self ._send_check_reply (b"AT+CIPSHUT" , reply = b"SHUT OK" , timeout = 20000 ):
293+ if not self ._send_check_reply (
294+ b"AT+CIPSHUT" , reply = b"SHUT OK" , timeout = 20000
295+ ):
294296 return False
295297
296298 if not self ._send_check_reply (b"AT+CGATT=1" , reply = REPLY_OK , timeout = 10000 ):
@@ -338,7 +340,9 @@ def _set_gprs(self, gprs_on=True):
338340 return False
339341
340342 # Open GPRS context
341- if not self ._send_check_reply (b"AT+SAPBR=1,1" , reply = REPLY_OK , timeout = 1850 ):
343+ if not self ._send_check_reply (
344+ b"AT+SAPBR=1,1" , reply = REPLY_OK , timeout = 1850
345+ ):
342346 return False
343347
344348 # Bring up wireless connection
@@ -514,7 +518,9 @@ def get_host_by_name(self, hostname):
514518
515519 if self ._debug :
516520 print ("\t ---> AT+CDNSGIP=" , hostname )
517- if not self ._send_check_reply (b'AT+CDNSGIP="' + hostname + b'"\r \n ' , reply = REPLY_OK ):
521+ if not self ._send_check_reply (
522+ b'AT+CDNSGIP="' + hostname + b'"\r \n ' , reply = REPLY_OK
523+ ):
518524 return False
519525
520526 # attempt to parse a response
@@ -536,14 +542,14 @@ def get_socket(self):
536542 print ("*** Allocating Socket" )
537543
538544 self ._uart .write (b"AT+CIPSTATUS\r \n " )
539- self ._read_line (100 ) # OK
540- self ._read_line (100 ) # table header
545+ self ._read_line (100 ) # OK
546+ self ._read_line (100 ) # table header
541547
542548 for sock in range (0 , FONA_MAX_SOCKETS ):
543549 # parse and check for INITIAL client state
544550 self ._read_line (100 )
545- self ._parse_reply (b'C:' , idx = 5 )
546- if self ._buf .strip ('\ " ' ) == "INITIAL" or self ._buf .strip ('\ " ' ) == "CLOSED" :
551+ self ._parse_reply (b"C:" , idx = 5 )
552+ if self ._buf .strip ('"' ) == "INITIAL" or self ._buf .strip ('"' ) == "CLOSED" :
547553 break
548554 # read out the rest of the responses
549555 for _ in range (sock , FONA_MAX_SOCKETS ):
@@ -688,7 +694,7 @@ def socket_close(self, sock_num, quick_close=1):
688694 sockets for the FONA module."
689695 self ._read_line ()
690696
691- self ._uart .write (b"AT+CIPCLOSE=" + str (sock_num ).encode () + b"," )
697+ self ._uart .write (b"AT+CIPCLOSE=" + str (sock_num ).encode () + b"," )
692698 self ._uart .write (str (sock_num ).encode () + b"\r \n " )
693699 self ._read_line ()
694700 if not self ._parse_reply (b"CLOSE OK" , idx = 0 ):
0 commit comments