Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Upload gcode file with http request

    Scheduled Pinned Locked Moved
    Duet Web Control
    2
    2
    193
    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.
    • JDFestoundefined
      JDFesto
      last edited by

      I am currently attempting to use python's request library to upload a ".g" or gcode instruction file from my computer to a Duet 3 MB 6HC, with RepRap Firmware 3.4.5 (2022-11-30). Every other get and post has been working but when it comes to uploading said file I have an issue. When I send the file content with the post request the entire content gets encapsulated with quotations making the instructions useless to the duet.

      response = requests.post(url="ip/rr_upload", params = {"name": "0:/macros/sample.g"}, 
                           json=open("sample.g").read())
      

      When looking at the download request on the browser I can see that the file has been successfully uploaded however the entire file is encapsulated with quotations. Is there a way for the duetboard to ignore the quotes?

      Sindariusundefined 1 Reply Last reply Reply Quote 0
      • Sindariusundefined
        Sindarius @JDFesto
        last edited by

        @JDFesto I have not had the opportunity to play with the python library but instead of sending it as

        json=open("sample.g").read()
        

        have you tried

        data=open("sample.g").read()
        
        1 Reply Last reply Reply Quote 0
        • JDFestoundefined JDFesto marked this topic as a question
        • JDFestoundefined JDFesto marked this topic as a regular topic
        • JDFestoundefined JDFesto marked this topic as a question
        • JDFestoundefined JDFesto marked this topic as a regular topic
        • First post
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA