Jump to content
Ultimaker Community of 3D Printing Experts

Post Script, Python requests to PHP


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
     Share

    • Our picks

      • New here? Get ahead with a free onboarding course
        Hi,
         
        Often getting started is the most difficult part of any process. A good start sets you up for success and saves you time and energy that could be spent elsewhere. That is why we have a onboarding course ready for
        Ultimaker S5 Pro Bundle, Ultimaker S5, Ultimaker S3 Ultimaker 2+ Connect.   
        They're ready for you on the Ultimaker Academy platform. All you need to do to gain access is to register your product to gain free access. 
        Ready? Register your product here in just 60 seconds.
          • Like
        • 11 replies
    ×
    ×
    • Create New...