← Back to team overview

libsurl team mailing list archive

Re: Python function?

 

No, these functions are great and should make CDLL happy.
CDLL doesn't understand C types. For example, a function that returns SURL will just return an integer in Python. When you pass that to other functions, it throws an exception because "it expected SURL but got int."

By the way, I think libsurl have almost reached surl apart from several other services. Plugins (and maybe scripting?) are surl's job, not libsurl's.

On 12/25/2009 09:29 PM, Scott Lawrence wrote:
I don't know how python's C-interface works yet, but: for version 0.6,
the libsurl API is going to include functions along the lines of
(details to be worked out later)

char *surl_qshort(char *url) // picks a few services, and picks the
shortest resulting URL
char *surl_easy_shorten(char *service, char *url); // for normal people
char *surl_do_shorten(char *service,char *url,char *key,char
*whatever_else) // as specified above.

Any other suggestions?

I plan to have surl using the libsurl API around version 0.8 (of both
- version numbers roughly correspond as of libsurl-0.5).


On 12/25/09, Ahmed Elmahdawy<aa_mahdawy@xxxxxxxxxxx>  wrote:
Looking at libsurl's source code, I've found that it seems almost
impossible for Python's -- or in this case, surl -- CDLL to call it.
What can be done in the future is to implement a simple function that
takes all arguments (url, api key, etc and null for none) and returns
the shortened API.
Here's an example:

char *surl_pyget(char *url, char *service, char *key, /more args/)
{
/// do surl_getopt()'s, null or empty string=ignore/
      char *shortUrl = /shortened url/;
      // /cleanup/
      return shortUrl;
}

Regards,
Ahmed Elmahdawy







Follow ups

References