Jump to content

Post Script, Python requests to PHP


jumbo125

Recommended Posts

Posted · Post Script, Python requests to PHP
9 minutes ago, jumbo125 said:

Yeah, 

Does i need Install a libary?

Die you have a smale example/Script?

Cura has the option to do requests built in, see

https://github.com/Ultimaker/Uranium/blob/1eacb050882b7ad63dfd1e731ee35eafbd07c93d/UM/TaskManagement/HttpRequestManager.py


There are quite a few of examples in the Cura source code where we use this to get responses from a server.

As for how to set up an API in PHP, i don't have any experience with that, but there are tons of examples on the internet about that.

  • Link to post
    Share on other sites

    Posted · Post Script, Python requests to PHP

    Thank you a lot for your help!!!

    i think the solution is in this code:

     def post(self, url: str,
                 headers_dict: Optional[Dict[str, str]] = None,
                 data: Optional[Union[bytes, bytearray]] = None,
                 callback: Optional[Callable[["QNetworkReply"], None]] = None,
                 error_callback: Optional[Callable[["QNetworkReply", "QNetworkReply.NetworkError"], None]] = None,
                 download_progress_callback: Optional[Callable[[int, int], None]] = None,
                 upload_progress_callback: Optional[Callable[[int, int], None]] = None,
                 timeout: Optional[float] = None,
                 scope: Optional[HttpRequestScope] = None) -> "HttpRequestData":
            return self._createRequest("post", url, headers_dict = headers_dict, data = data,
                                       callback = callback, error_callback = error_callback,
                                       download_progress_callback = download_progress_callback,
                                       upload_progress_callback = upload_progress_callback,
                                       timeout = timeout,
                                       scope = scope)

    now i only need to unterstand, to write the correct syntax to send the request and get the data with scope. I think scope is the successful... is it right?

  • Link to post
    Share on other sites

    Posted · Post Script, Python requests to PHP

    okay. i think that's too much for me. Thank you

  • Link to post
    Share on other sites

    Posted · Post Script, Python requests to PHP

    @nallath i can't give Up....

    Do you can me tell, where Dome Code Part in the Cura source Code?

    Thank you

  • Link to post
    Share on other sites

    Posted (edited) · Post Script, Python requests to PHP

    Okay i did it, but it didn't work correct. At this time i get no fails, but it didn't connect to server

    the code


     

    Edited by jumbo125
  • Link to post
    Share on other sites

    Posted (edited) · Post Script, Python requests to PHP

    Sorry. My fail. 

    Please delete post

    Edited by jumbo125
  • Link to post
    Share on other sites

    Posted (edited) · Post Script, Python requests to PHP

    my fail

     

    Edited by jumbo125
  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 18 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...