Using PyCurl Module in Python Scripts
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?
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
</pre>will print the html for the main Python webpage. I have found Requests quite easy to use even for complex use cases.
Thanks @ccc. Its a great help. I'll look into that.
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.
You can also look at the source code -- internally it simply uses
requests, which comes bundled with pythonista.
@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)
@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.