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

    M5Stick C 'http GET'

    Scheduled Pinned Locked Moved UIFlow
    6 Posts 3 Posters 12.4k Views
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            ianlyonthomas
            last edited by

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

            1 Reply Last reply Reply Quote 0
            • sodokuS Offline
              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 Offline
                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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post