curl-and-python
RE: Curl RTSP Commands not Available in Python?
Date: Fri, 9 Mar 2012 21:43:17 +0530
> Date: Fri, 9 Mar 2012 10:01:10 -0500> From: nate_at_redtetrahedron.org> To: curl-and-python_at_cool.haxx.se> Subject: Re: Curl RTSP Commands not Available in Python?> > On 3/9/2012 3:17 AM, Utsav Sabharwal wrote:> >>> To add the RTSP functionality to pycURL, is it a matter of adding the RTSP> > options to pycurl.c ?> >>>> >>> Example just adding the lines:> >>> insint_c(d, "RTSP_STREAM_URI", CURLOPT_RTSP_STREAM_URI);> >>> insint_c(d, "RTSP_REQUEST", CURLOPT_RTSP_REQUEST);> >> It might be worth to make some sort of (python?) script that extracts that> >> information from the public curl headers and generates the necessary glue code> >> from that, so it will be easier to just re-run it when new libcurl releases> >> ship!> >>> >> libcurl is known to release roughly every second month, and we add new options> >> rather frequently...> >>> >> -- > >>> >> / daniel.haxx.se> >>> >>> > That sounds as a good idea. > > Right now the options are hard coded as per libcurl 7.19.0. Now the problem is each function of C API is m
apped with Python API.> > For example:> >> > CURLOPT_URL is just called as url in pycURLExample:c.setopt(pycurl.URL, url)> > Reference: https://github.com/utsavsabharwal/Crawlers-Research-Arena/blob/master/curl/18/crawler.py> > Now, if the code automatically fetches the options from public curl headers then we shall loose the mapping. > > Pros:> > pycURL could be run with any version of libcurl without depreciating any feature. > > Rich libcurl documentation can be used for pycURL also. > > pycURL would not be called an old tool unfit for current internet tackling. Rather, without human support it would remain updated and syncd with libcurl> >> > Cons: > > The codes written in previous pycURL version would not run with the new version > > Users who only use pycURL must now learn libcurl commands which differ from current > > pycURL commands but learning it can make them capable to use C API in future with ease. :p> >> >> > p,s,: Taking into consideration frequency of libcurl updates and lack of manpower @ py
cURL developers I feel making this change would be good.> >> To allow for renaming the constants without breaking old code this could > be done.> 1) move old constants to a sub module -- example name pycurl.old_constants> 2) define new constants in a sub module -- example name > pycurl.current_constants> 3) create yet another module named something like pycurlbackcompat that > defines a single Boolean constant name used_old_constants defaulting to > False.> 4) in pycurl upon import: import and check the value of > pycurl.backcompat.use_old_constants. If True issue a deprecation warning > and import * from pycurl.old_constants. If False (the default) do import > * from pycurl.current_constants.> > While this still introduces a breaking change, the fix to keep old code > working is only two line long. Which is much better than having to > change ever place you used a constant.> > I believe this can all be done via the python c api, and I know it can > be in python.> > Nathan Moore> ____________________________
___________________> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Sounds good. We can add support for both new and old version easily. -:)
Now the second challenge.. .
libcurl doc (http://curl.haxx.se/libcurl/c/allfuncs.html) says we have following functions:
curl_easy_cleanup curl_easy_duphandle curl_easy_escape curl_easy_getinfo curl_easy_init curl_easy_pause curl_easy_perform curl_easy_recv curl_easy_reset curl_easy_send curl_easy_setopt curl_easy_strerror curl_easy_unescape curl_escape (deprecated, do not use) curl_formadd curl_formfree curl_formget curl_free curl_getdate curl_getenv (deprecated, do not use) curl_global_cleanup curl_global_init curl_global_init_mem curl_mprintf (deprecated, do not use) curl_multi_add_handle curl_multi_assign curl_multi_cleanup curl_multi_fdset curl_multi_info_read curl_multi_init curl_multi_perform curl_multi_remove_handle curl_multi_setopt curl_multi_socket curl_multi_strerror curl_multi_timeout curl_share_cleanup curl_share_init curl_share_setopt curl_share_strerror curl_slist_append curl_slist_free_all curl_strequal (deprecated, do not use) curl_strnequal (deprecated, do not use) curl_unescape (deprecated, do not use) curl_version curl_version_info
Where are all of them defined? The majors functions I could find here: https://github.com/bagder/curl/blob/master/include/curl/curl.h
What about others? Like curl_easy_cleanup, curl_easy_duphandle ??
Bottom Line: I want to recreate the API and this time I wish to fetch the funciton names from libcurl and let function parameters be passed from python user code to c code directly. So we just provide the python connection to libcurl. Thats it.
d_r_a_g_o_s
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2012-03-09