Gpy + Pysense - urequests AttributeError: 'module' object has no attribute 'get'

  • Hi

    I am trying to make an HTTP get request for testing but have getting this message: library downloaded from

    Please give me some help, i am started with Pycom...

    Network found!
    WLAN connection succeeded!

    RTC Set from NTP to UTC: (2018, 2, 28, 14, 23, 38, 97276, None)
    Traceback (most recent call last):
    File "", line 11, in <module>
    AttributeError: 'module' object has no attribute 'get'
    MicroPython v1.8.6-849-055728a on 2018-02-13; GPy with ESP32
    Type "help()" for more information.

    import machine
    from network import WLAN
    wlan = WLAN(mode=WLAN.STA)
    nets = wlan.scan()
    for net in nets:
        if net.ssid == 'REMOVED':
            print('Network found!')
            wlan.connect(net.ssid, auth=(net.sec, 'REMOVED.'), timeout=5000)
            while not wlan.isconnected():
                machine.idle() # save power while waiting
            print('WLAN connection succeeded!')
    import urequests as requests
    import utime
    from machine import RTC
    rtc = machine.RTC()
    print('\nRTC Set from NTP to UTC:',
    r = requests.get('')




  • @seb Everything work fine, after sync again!

    Thank you very much

  • administrators


    Ah there seems to have been an issue syncing the library because the output should be:

    >>> import urequests as requests
    >>> print(dir(requests))
    ['put', 'post', 'usocket', 'patch', 'request', '__file__', '__name__', 'delete', 'head', 'Response', 'get']
    >>> print(type(requests))
    <class 'module'>

    Can you please run the following to clear your device and sync again:

    import os

  • @seb 0_1519832656878_ddfd0422-4584-428d-8911-8fa806db1689-image.png

    thank you very much for your help!

  • administrators


    In the REPL console can you please run the following:

    import urequests as requests

  • @seb Yes i have the latest firmware, updated yesterday, Gpy, and Pysense

    i have patch line 53, and the problem remains

  • administrators

    1. Are you on the latest firmware?
    2. Are you sure you have correctly downloaded the file from the link you provided? When I attempted to run this code I could not replicate your error. I did however have to patch line 53 to be:
        ai = usocket.getaddrinfo(host, port)

Pycom on Twitter

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.