🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Stick C 'http GET'

    UIFlow
    3
    6
    10.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      ianlyonthomas
      last edited by

      Hi,
      I am using M5Stick C and have put together a blocky which is a simple http GET process.
      i.e. connect to WiFi and send data via GET.
      The Data (Key&Value) is populated and the solution successfully sends to the correct URL but...

      No data is being included in the URL sent.
      On checking the Python code, the data is not added.

      Is this a bug?

      Python code generated via Blocky is below and I can provide .m5f if required.

      Thanks
      Ian

      from m5stack import *
      from m5ui import *
      from uiflow import *
      import wifiCfg
      import urequests

      setScreenColor(0x111111)

      wifiCfg.doConnect('XXXXXXXX', 'XXXXXXXXX')
      label0 = M5TextBox(0, 16, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
      label1 = M5TextBox(0, 55, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)

      if wifiCfg.wlan_sta.isconnected():
      label1.setColor(0x3333ff)
      label1.setFont(lcd.FONT_DejaVu18)
      label1.setText('connected')
      try:
      req = urequests.request(method='GET', url='http://URL.com/insertGet.php', headers={})
      label1.setText('SENT')
      label0.setColor(0x33ff33)
      label0.setFont(lcd.FONT_DejaVu18)
      label0.setText(str(req.status_code))
      except:
      pass
      else:
      label1.setColor(0xff0000)
      label1.setText('NOT SENT')

      1 Reply Last reply Reply Quote 0
      • M
        mb
        last edited by

        Within Python it seems there are no parameters set.

        You can add them in Blockly at Advanced -> Http -> Http Request -> Data with a Map?

        Can you provide a screenshot? (If you need an image upload service, use imgpile.com or similar)

        1 Reply Last reply Reply Quote 0
        • I
          ianlyonthomas
          last edited by

          Sorry, I was not clear.

          Within Data>Create Map, I have added key: Temperature, Value:30 and key:Humidity, Value:50

          These are not present within the Python code.

          I will upload an image of the blocky.

          Ian

          1 Reply Last reply Reply Quote 0
          • I
            ianlyonthomas
            last edited by

            For blocky screen shot https://imgpile.com/i/798bPr

            1 Reply Last reply Reply Quote 0
            • sodokuS
              sodoku
              last edited by

              It ignores the data when using "GET", if you set it to e.g. "POST" the python code includes the data.

              1 Reply Last reply Reply Quote 0
              • I
                ianlyonthomas
                last edited by

                Bit confused as to why the 'Data' is ignored in GET.

                Switched to POST but data is still not delivered. I will continue to test and se if I can isolate issue.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post