omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Using PyCurl Module in Python Scripts

    Pythonista
    4
    7
    3577
    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.
    • atanu_dey75
      atanu_dey75 last edited by

      Hello,

      I was going through the capabilities of Pythonista. My requirement is I want to write iOS apps using python. But my app will use pycurl. Can I install and pycurl module separately in Pythonista?

      According to this link - http://omz-software.com/pythonista/docs/ios/index.html

      By default Pythonista has some preinstalled modules which are mentioned in the above link right?

      Is it at possible to use pycurl using Pythonista?

      Thanks

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        Pycurl relies on libcurl which appears to be a C library so porting it over to Pythonista might be quite a bit of work.

        I would recommend that you look into the Requests module as an alternative (the last line on the web page you mentioned above). Requests - HTTP for Humans has a different syntax than pycurl but I bet that it enables all the same functionality. For example:<pre>import requests
        theHTML = requests.get('http://www.python.org').text
        print(theHTML)
        </pre>will print the html for the main Python webpage. I have found Requests quite easy to use even for complex use cases.

        halloween 1 Reply Last reply Reply Quote 1
        • atanu_dey75
          atanu_dey75 last edited by

          Thanks @ccc. Its a great help. I'll look into that.

          1 Reply Last reply Reply Quote 0
          • halloween
            halloween @ccc last edited by

            @ccc
            Hoping you receive this as this was 8 years ago, do you know of a way to download pycurl? I saw you recommend an alternative but I unable to use an alternative it has to be pycurl.

            JonB 2 Replies Last reply Reply Quote 1
            • JonB
              JonB @halloween last edited by

              @halloween if you just want to have a command line equivalent of curl, a simple version is included in stash, the pythonista bash clone. See https://github.com/ywangd/stash

              You can also look at the source code -- internally it simply uses requests, which comes bundled with pythonista.

              1 Reply Last reply Reply Quote 1
              • JonB
                JonB @halloween last edited by JonB

                @halloween also just to be clear -- pycurl is written in c. IOS sandbox prevents running of unsigned executable code, so unless this was included in the pythonista app already, you will not be able to run it. If you NEED the interface exposed by pycurl your options are to write your own class that exactly mimics the pycurl api, but under the hood uses requests. Or a wrapper which json's up the input arguments, passes those to an AWS lambda that you have set up to process pycurl function calls, then takes the results from the lambda, and decodes the JSON back so that the output looks identical.

                (Second option is only half serious, you'd need to work out persistence, if you need the Curl object to hang around)

                halloween 1 Reply Last reply Reply Quote 1
                • halloween
                  halloween @JonB last edited by

                  @JonB I got an RDP so I can use actual Python. But I have one problem, when I try to run a script I have it immediately closes.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors