M
					
						
					
				
				
					Hi. I know this may be a little late, but I have some code that enables LTE-CATM1 connection through hologram and to send a message into their socket.
I would also recommend not specifying the carrier because Hologram.io takes care of that.
Here is my code: Also note that hologram.io working with Python requires that you send a bytearray in ASCII format. At least from my testing, that's the only way I could get it to work.
import socket
import time
import pycom
from machine import RTC
from network import LTE
from network import WLAN
HOST = "cloudsocket.hologram.io"
PORT = 9999
DEVICE_KEY = "ABCDEFG" #generated on hologram's portal for each SIM card.
TOPIC = "TOPIC1"
# # Need to use global variables.
# # If in each function you delare a new reference, functionality is broken
lte = LTE()
# Returns a network.LTE object with an active Internet connection.
def getLTE():
    # If already used, the lte device will have an active connection.
    # If not, need to set up a new connection.
    if lte.isconnected():
        return lte
    # Modem does not connect successfully without first being reset.
    print("Resetting LTE modem ... ", end="")
    lte.send_at_cmd('AT^RESET')
    print("OK")
    time.sleep(1)
    # While the configuration of the CGDCONT register survives resets,
    # the other configurations don't. So just set them all up every time.
    print("Configuring LTE ", end='')
    lte.send_at_cmd('AT+CGDCONT=1,"IP","hologram"')  # Changed this from origninal
    print(".", end='')
    lte.send_at_cmd('AT!="RRC::addscanfreq band=4 dl-earfcn=9410"') # changed band from 28 to 4. I dont know what earfcn=9410 is;
    print(".", end='')
    lte.send_at_cmd('AT+CFUN=1')
    print(" OK")
    # If correctly configured for carrier network, attach() should succeed.
    if not lte.isattached():
        print("Attaching to LTE network ", end='')
        lte.attach()
        while(True):
            if lte.isattached():
                print(" OK")
                #pycom.rgbled(0x00FF00)
                #time.sleep(.5)
                #pycom.rgbled(0x000000)
                break
            print('.', end='')
            time.sleep(1)
    # Once attached, connect() should succeed.
    if not lte.isconnected():
        print("Connecting on LTE network ", end='')
        lte.connect()
        while(True):
            if lte.isconnected():
                print(" OK")
                break
            print('.', end='')
            time.sleep(1)
    # Once connect() succeeds, any call requiring Internet access will
    # use the active LTE connection.
    return lte
# Clean disconnection of the LTE network is required for future
# successful connections without a complete power cycle between.
def endLTE():
    print("Disonnecting LTE ... ", end='')
    lte.disconnect()
    print("OK")
    time.sleep(1)
    print("Detaching LTE ... ", end='')
    lte.dettach()
    print("OK")
    
# Program starts here.
try:
    lte = getLTE()
    print(lte)
    s = socket.socket()
    print(s)
    dns_records = socket.getaddrinfo(HOST, PORT)
    print("got dns_records")
    print(dns_records)
    
    message = "Hello World!"
    
    for record in dns_records:
        try:
            s.connect(record[-1])
            print("connected")
            data = '{"k": "%s", "d": "%s", "t": "%s"}' % (DEVICE_KEY, message, TOPIC)
            s.send(bytes(data, 'ascii'))
            print("sent")
            result = s.recv(8).decode()
            print(result)
            s.close()
            break
        except Exception as err1:
            try:
                s.close()
            except:
                pass
            print(err1)
            continue
except Exception as err:
    print(err)
    try:
        s.close()
    except:
        pass
finally:
   endLTE()