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

      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Like
        • 2 replies
      • 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
        • 26 replies
    ×
    ×
    • Create New...