clodpy 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clodpy-1.0.0/PKG-INFO +37 -0
- clodpy-1.0.0/clodpy/__init__.py +8 -0
- clodpy-1.0.0/clodpy/cl.py +81 -0
- clodpy-1.0.0/clodpy/ct.py +160 -0
- clodpy-1.0.0/clodpy/err.py +2 -0
- clodpy-1.0.0/clodpy/pat.py +6 -0
- clodpy-1.0.0/clodpy.egg-info/PKG-INFO +37 -0
- clodpy-1.0.0/clodpy.egg-info/SOURCES.txt +13 -0
- clodpy-1.0.0/clodpy.egg-info/dependency_links.txt +1 -0
- clodpy-1.0.0/clodpy.egg-info/requires.txt +1 -0
- clodpy-1.0.0/clodpy.egg-info/top_level.txt +1 -0
- clodpy-1.0.0/nat/bnd.c +26 -0
- clodpy-1.0.0/nat/cld.c +66 -0
- clodpy-1.0.0/setup.cfg +4 -0
- clodpy-1.0.0/setup.py +64 -0
clodpy-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clodpy
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python CFFI bindings for libcurl
|
|
5
|
+
Home-page: https://github.com/hhvvm1
|
|
6
|
+
Author: JA3FR
|
|
7
|
+
Author-email:
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Reports, https://github.com/hhvvm1
|
|
10
|
+
Project-URL: Source, https://github.com/hhvvm1
|
|
11
|
+
Keywords: http https curl networking web requests
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Requires-Python: >=3.6
|
|
25
|
+
Requires-Dist: cffi>=1.15.0
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: keywords
|
|
31
|
+
Dynamic: license
|
|
32
|
+
Dynamic: project-url
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
36
|
+
|
|
37
|
+
Fast and reliable HTTP client for Python using libcurl
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from .ct import O, I, E
|
|
3
|
+
from .err import CE
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
from ._cld_nat import ffi, lib
|
|
7
|
+
except ImportError:
|
|
8
|
+
ffi = lib = None
|
|
9
|
+
|
|
10
|
+
class C:
|
|
11
|
+
def __init__(self):
|
|
12
|
+
if lib is None:
|
|
13
|
+
raise CE("Native library not found. Install libcurl.")
|
|
14
|
+
|
|
15
|
+
self._handle = lib.cld_init()
|
|
16
|
+
if self._handle == ffi.NULL:
|
|
17
|
+
raise CE("Failed to initialize curl")
|
|
18
|
+
|
|
19
|
+
self._callbacks = {}
|
|
20
|
+
self._headers = None
|
|
21
|
+
self._closed = False
|
|
22
|
+
|
|
23
|
+
def __enter__(self):
|
|
24
|
+
return self
|
|
25
|
+
|
|
26
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
27
|
+
self.close()
|
|
28
|
+
|
|
29
|
+
def __del__(self):
|
|
30
|
+
if not self._closed and hasattr(self, '_handle'):
|
|
31
|
+
self.close()
|
|
32
|
+
|
|
33
|
+
def setopt(self, option, value):
|
|
34
|
+
if self._closed:
|
|
35
|
+
raise CE("Handle is closed")
|
|
36
|
+
|
|
37
|
+
code = lib.cld_setopt(self._handle, option, value)
|
|
38
|
+
if code != E.OK:
|
|
39
|
+
raise CE(f"Failed to set option {option}: {E.to_str(code)}")
|
|
40
|
+
|
|
41
|
+
return self
|
|
42
|
+
|
|
43
|
+
def getinfo(self, option):
|
|
44
|
+
if self._closed:
|
|
45
|
+
raise CE("Handle is closed")
|
|
46
|
+
|
|
47
|
+
if option & 0xF00000 == 0x100000:
|
|
48
|
+
result = ffi.new("char**")
|
|
49
|
+
lib.cld_getinfo(self._handle, option, result)
|
|
50
|
+
return ffi.string(result[0]).decode() if result[0] else ""
|
|
51
|
+
elif option & 0xF00000 == 0x200000:
|
|
52
|
+
result = ffi.new("long*")
|
|
53
|
+
lib.cld_getinfo(self._handle, option, result)
|
|
54
|
+
return int(result[0])
|
|
55
|
+
elif option & 0xF00000 == 0x300000:
|
|
56
|
+
result = ffi.new("double*")
|
|
57
|
+
lib.cld_getinfo(self._handle, option, result)
|
|
58
|
+
return float(result[0])
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
def perform(self):
|
|
62
|
+
if self._closed:
|
|
63
|
+
raise CE("Handle is closed")
|
|
64
|
+
|
|
65
|
+
code = lib.cld_perform(self._handle)
|
|
66
|
+
if code != E.OK:
|
|
67
|
+
raise CE(f"Perform failed: {E.to_str(code)}")
|
|
68
|
+
|
|
69
|
+
def reset(self):
|
|
70
|
+
if not self._closed:
|
|
71
|
+
lib.cld_reset(self._handle)
|
|
72
|
+
return self
|
|
73
|
+
|
|
74
|
+
def close(self):
|
|
75
|
+
if not self._closed and hasattr(self, '_handle'):
|
|
76
|
+
if self._handle != ffi.NULL:
|
|
77
|
+
lib.cld_cleanup(self._handle)
|
|
78
|
+
self._handle = ffi.NULL
|
|
79
|
+
self._closed = True
|
|
80
|
+
self._callbacks.clear()
|
|
81
|
+
self._headers = None
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
class O:
|
|
2
|
+
URL = 10002
|
|
3
|
+
PORT = 3
|
|
4
|
+
PROXY = 10004
|
|
5
|
+
USERPWD = 10005
|
|
6
|
+
PROXYUSERPWD = 10006
|
|
7
|
+
HTTPGET = 80
|
|
8
|
+
HTTPPOST = 10024
|
|
9
|
+
HTTPHEADER = 10023
|
|
10
|
+
USERAGENT = 10018
|
|
11
|
+
REFERER = 10016
|
|
12
|
+
CUSTOMREQUEST = 10036
|
|
13
|
+
WRITEFUNCTION = 20011
|
|
14
|
+
READFUNCTION = 20012
|
|
15
|
+
HEADERFUNCTION = 20079
|
|
16
|
+
PROGRESSFUNCTION = 20056
|
|
17
|
+
WRITEDATA = 10001
|
|
18
|
+
READDATA = 10009
|
|
19
|
+
HEADERDATA = 10029
|
|
20
|
+
PROGRESSDATA = 10057
|
|
21
|
+
TIMEOUT = 13
|
|
22
|
+
TIMEOUT_MS = 155
|
|
23
|
+
CONNECTTIMEOUT = 78
|
|
24
|
+
CONNECTTIMEOUT_MS = 156
|
|
25
|
+
SSL_VERIFYPEER = 64
|
|
26
|
+
SSL_VERIFYHOST = 81
|
|
27
|
+
CAINFO = 10065
|
|
28
|
+
FOLLOWLOCATION = 52
|
|
29
|
+
MAXREDIRS = 68
|
|
30
|
+
VERBOSE = 41
|
|
31
|
+
NOPROGRESS = 43
|
|
32
|
+
FAILONERROR = 45
|
|
33
|
+
COOKIEFILE = 10031
|
|
34
|
+
COOKIEJAR = 10082
|
|
35
|
+
|
|
36
|
+
FILE = WRITEDATA
|
|
37
|
+
INFILE = READDATA
|
|
38
|
+
WRITEHEADER = HEADERDATA
|
|
39
|
+
|
|
40
|
+
class I:
|
|
41
|
+
EFFECTIVE_URL = 0x100001
|
|
42
|
+
RESPONSE_CODE = 0x200002
|
|
43
|
+
TOTAL_TIME = 0x300003
|
|
44
|
+
NAMELOOKUP_TIME = 0x300004
|
|
45
|
+
CONNECT_TIME = 0x300005
|
|
46
|
+
PRETRANSFER_TIME = 0x300006
|
|
47
|
+
SIZE_UPLOAD = 0x300007
|
|
48
|
+
SIZE_DOWNLOAD = 0x300008
|
|
49
|
+
SPEED_DOWNLOAD = 0x300009
|
|
50
|
+
SPEED_UPLOAD = 0x300010
|
|
51
|
+
HEADER_SIZE = 0x200011
|
|
52
|
+
REQUEST_SIZE = 0x200012
|
|
53
|
+
SSL_VERIFYRESULT = 0x200013
|
|
54
|
+
FILETIME = 0x200014
|
|
55
|
+
CONTENT_LENGTH_DOWNLOAD = 0x300015
|
|
56
|
+
CONTENT_LENGTH_UPLOAD = 0x300016
|
|
57
|
+
STARTTRANSFER_TIME = 0x300017
|
|
58
|
+
CONTENT_TYPE = 0x100018
|
|
59
|
+
REDIRECT_TIME = 0x300019
|
|
60
|
+
REDIRECT_COUNT = 0x200020
|
|
61
|
+
PRIMARY_IP = 0x100032
|
|
62
|
+
PRIMARY_PORT = 0x200040
|
|
63
|
+
LOCAL_IP = 0x100041
|
|
64
|
+
LOCAL_PORT = 0x200042
|
|
65
|
+
|
|
66
|
+
HTTP_CODE = RESPONSE_CODE
|
|
67
|
+
|
|
68
|
+
class E:
|
|
69
|
+
OK = 0
|
|
70
|
+
UNSUPPORTED_PROTOCOL = 1
|
|
71
|
+
FAILED_INIT = 2
|
|
72
|
+
URL_MALFORMAT = 3
|
|
73
|
+
NOT_BUILT_IN = 4
|
|
74
|
+
COULDNT_RESOLVE_PROXY = 5
|
|
75
|
+
COULDNT_RESOLVE_HOST = 6
|
|
76
|
+
COULDNT_CONNECT = 7
|
|
77
|
+
WEIRD_SERVER_REPLY = 8
|
|
78
|
+
REMOTE_ACCESS_DENIED = 9
|
|
79
|
+
FTP_ACCEPT_FAILED = 10
|
|
80
|
+
FTP_WEIRD_PASS_REPLY = 11
|
|
81
|
+
FTP_ACCEPT_TIMEOUT = 12
|
|
82
|
+
FTP_WEIRD_PASV_REPLY = 13
|
|
83
|
+
FTP_WEIRD_227_FORMAT = 14
|
|
84
|
+
FTP_CANT_GET_HOST = 15
|
|
85
|
+
HTTP2 = 16
|
|
86
|
+
FTP_COULDNT_SET_TYPE = 17
|
|
87
|
+
PARTIAL_FILE = 18
|
|
88
|
+
FTP_COULDNT_RETR_FILE = 19
|
|
89
|
+
QUOTE_ERROR = 21
|
|
90
|
+
HTTP_RETURNED_ERROR = 22
|
|
91
|
+
WRITE_ERROR = 23
|
|
92
|
+
UPLOAD_FAILED = 25
|
|
93
|
+
READ_ERROR = 26
|
|
94
|
+
OUT_OF_MEMORY = 27
|
|
95
|
+
OPERATION_TIMEDOUT = 28
|
|
96
|
+
FTP_PORT_FAILED = 30
|
|
97
|
+
FTP_COULDNT_USE_REST = 31
|
|
98
|
+
RANGE_ERROR = 33
|
|
99
|
+
HTTP_POST_ERROR = 34
|
|
100
|
+
SSL_CONNECT_ERROR = 35
|
|
101
|
+
BAD_DOWNLOAD_RESUME = 36
|
|
102
|
+
FILE_COULDNT_READ_FILE = 37
|
|
103
|
+
LDAP_CANNOT_BIND = 38
|
|
104
|
+
LDAP_SEARCH_FAILED = 39
|
|
105
|
+
FUNCTION_NOT_FOUND = 41
|
|
106
|
+
ABORTED_BY_CALLBACK = 42
|
|
107
|
+
BAD_FUNCTION_ARGUMENT = 43
|
|
108
|
+
INTERFACE_FAILED = 45
|
|
109
|
+
TOO_MANY_REDIRECTS = 47
|
|
110
|
+
UNKNOWN_OPTION = 48
|
|
111
|
+
TELNET_OPTION_SYNTAX = 49
|
|
112
|
+
PEER_FAILED_VERIFICATION = 51
|
|
113
|
+
GOT_NOTHING = 52
|
|
114
|
+
SSL_ENGINE_NOTFOUND = 53
|
|
115
|
+
SSL_ENGINE_SETFAILED = 54
|
|
116
|
+
SEND_ERROR = 55
|
|
117
|
+
RECV_ERROR = 56
|
|
118
|
+
SSL_CERTPROBLEM = 58
|
|
119
|
+
SSL_CIPHER = 59
|
|
120
|
+
SSL_CACERT = 60
|
|
121
|
+
BAD_CONTENT_ENCODING = 61
|
|
122
|
+
LDAP_INVALID_URL = 62
|
|
123
|
+
FILESIZE_EXCEEDED = 63
|
|
124
|
+
USE_SSL_FAILED = 64
|
|
125
|
+
SEND_FAIL_REWIND = 65
|
|
126
|
+
SSL_ENGINE_INITFAILED = 66
|
|
127
|
+
LOGIN_DENIED = 67
|
|
128
|
+
TFTP_NOTFOUND = 68
|
|
129
|
+
TFTP_PERM = 69
|
|
130
|
+
REMOTE_DISK_FULL = 70
|
|
131
|
+
TFTP_ILLEGAL = 71
|
|
132
|
+
TFTP_UNKNOWNID = 72
|
|
133
|
+
REMOTE_FILE_EXISTS = 73
|
|
134
|
+
TFTP_NOSUCHUSER = 74
|
|
135
|
+
CONV_FAILED = 75
|
|
136
|
+
CONV_REQD = 76
|
|
137
|
+
SSL_CACERT_BADFILE = 77
|
|
138
|
+
REMOTE_FILE_NOT_FOUND = 78
|
|
139
|
+
SSH = 79
|
|
140
|
+
SSL_SHUTDOWN_FAILED = 80
|
|
141
|
+
AGAIN = 81
|
|
142
|
+
SSL_CRL_BADFILE = 82
|
|
143
|
+
SSL_ISSUER_ERROR = 83
|
|
144
|
+
FTP_PRET_FAILED = 84
|
|
145
|
+
RTSP_CSEQ_ERROR = 85
|
|
146
|
+
RTSP_SESSION_ERROR = 86
|
|
147
|
+
FTP_BAD_FILE_LIST = 87
|
|
148
|
+
CHUNK_FAILED = 88
|
|
149
|
+
NO_CONNECTION_AVAILABLE = 89
|
|
150
|
+
SSL_PINNEDPUBKEYNOTMATCH = 90
|
|
151
|
+
SSL_INVALIDCERTSTATUS = 91
|
|
152
|
+
HTTP2_STREAM = 92
|
|
153
|
+
RECURSIVE_API_CALL = 93
|
|
154
|
+
|
|
155
|
+
@classmethod
|
|
156
|
+
def to_str(cls, code):
|
|
157
|
+
for key, value in cls.__dict__.items():
|
|
158
|
+
if not key.startswith('_') and value == code:
|
|
159
|
+
return key.replace('_', ' ').title()
|
|
160
|
+
return f"Unknown error ({code})"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clodpy
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python CFFI bindings for libcurl
|
|
5
|
+
Home-page: https://github.com/hhvvm1
|
|
6
|
+
Author: JA3FR
|
|
7
|
+
Author-email:
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Reports, https://github.com/hhvvm1
|
|
10
|
+
Project-URL: Source, https://github.com/hhvvm1
|
|
11
|
+
Keywords: http https curl networking web requests
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Requires-Python: >=3.6
|
|
25
|
+
Requires-Dist: cffi>=1.15.0
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: keywords
|
|
31
|
+
Dynamic: license
|
|
32
|
+
Dynamic: project-url
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
36
|
+
|
|
37
|
+
Fast and reliable HTTP client for Python using libcurl
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
setup.py
|
|
2
|
+
clodpy/__init__.py
|
|
3
|
+
clodpy/cl.py
|
|
4
|
+
clodpy/ct.py
|
|
5
|
+
clodpy/err.py
|
|
6
|
+
clodpy/pat.py
|
|
7
|
+
clodpy.egg-info/PKG-INFO
|
|
8
|
+
clodpy.egg-info/SOURCES.txt
|
|
9
|
+
clodpy.egg-info/dependency_links.txt
|
|
10
|
+
clodpy.egg-info/requires.txt
|
|
11
|
+
clodpy.egg-info/top_level.txt
|
|
12
|
+
nat/bnd.c
|
|
13
|
+
nat/cld.c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cffi>=1.15.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
clodpy
|
clodpy-1.0.0/nat/bnd.c
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#include "cld.h"
|
|
2
|
+
#include <cffi.h>
|
|
3
|
+
|
|
4
|
+
void* cld_init_wrap(void) {
|
|
5
|
+
return cld_init();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
void cld_cleanup_wrap(void* handle) {
|
|
9
|
+
cld_cleanup(handle);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
int cld_setopt_wrap(void* handle, int option, void* parameter) {
|
|
13
|
+
return cld_setopt(handle, option, parameter);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
int cld_perform_wrap(void* handle) {
|
|
17
|
+
return cld_perform(handle);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
int cld_getinfo_wrap(void* handle, int info, void* data) {
|
|
21
|
+
return cld_getinfo(handle, info, data);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void cld_reset_wrap(void* handle) {
|
|
25
|
+
cld_reset(handle);
|
|
26
|
+
}
|
clodpy-1.0.0/nat/cld.c
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#include "cld.h"
|
|
2
|
+
#include <stdlib.h>
|
|
3
|
+
#include <string.h>
|
|
4
|
+
|
|
5
|
+
static size_t write_callback(char* ptr, size_t size, size_t nmemb, void* userdata) {
|
|
6
|
+
size_t realsize = size * nmemb;
|
|
7
|
+
clod_buffer_t* mem = (clod_buffer_t*)userdata;
|
|
8
|
+
|
|
9
|
+
if (!mem->data) {
|
|
10
|
+
mem->data = (char*)malloc(1);
|
|
11
|
+
mem->size = 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
char* new_data = (char*)realloc(mem->data, mem->size + realsize + 1);
|
|
15
|
+
if (!new_data) {
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
mem->data = new_data;
|
|
20
|
+
memcpy(&(mem->data[mem->size]), ptr, realsize);
|
|
21
|
+
mem->size += realsize;
|
|
22
|
+
mem->data[mem->size] = 0;
|
|
23
|
+
|
|
24
|
+
return realsize;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
void* cld_init(void) {
|
|
28
|
+
return curl_easy_init();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
void cld_cleanup(void* handle) {
|
|
32
|
+
if (handle) {
|
|
33
|
+
curl_easy_cleanup((CURL*)handle);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
int cld_setopt(void* handle, int option, void* parameter) {
|
|
38
|
+
if (!handle) return CURLE_FAILED_INIT;
|
|
39
|
+
|
|
40
|
+
CURLoption opt = (CURLoption)option;
|
|
41
|
+
CURL* curl = (CURL*)handle;
|
|
42
|
+
|
|
43
|
+
if (opt == CURLOPT_WRITEDATA) {
|
|
44
|
+
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
|
|
45
|
+
} else if (opt == CURLOPT_WRITEHEADER) {
|
|
46
|
+
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_callback);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return curl_easy_setopt(curl, opt, parameter);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
int cld_perform(void* handle) {
|
|
53
|
+
if (!handle) return CURLE_FAILED_INIT;
|
|
54
|
+
return curl_easy_perform((CURL*)handle);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
int cld_getinfo(void* handle, int info, void* data) {
|
|
58
|
+
if (!handle) return CURLE_FAILED_INIT;
|
|
59
|
+
return curl_easy_getinfo((CURL*)handle, (CURLINFO)info, data);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void cld_reset(void* handle) {
|
|
63
|
+
if (handle) {
|
|
64
|
+
curl_easy_reset((CURL*)handle);
|
|
65
|
+
}
|
|
66
|
+
}
|
clodpy-1.0.0/setup.cfg
ADDED
clodpy-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from setuptools import setup, Extension
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
# Determine libraries based on platform
|
|
6
|
+
libraries = ["curl"]
|
|
7
|
+
if sys.platform == "win32":
|
|
8
|
+
libraries = ["libcurl", "ws2_32", "crypt32", "wldap32"]
|
|
9
|
+
elif sys.platform == "darwin":
|
|
10
|
+
libraries = ["curl"]
|
|
11
|
+
else:
|
|
12
|
+
libraries = ["curl"]
|
|
13
|
+
|
|
14
|
+
setup(
|
|
15
|
+
name="clodpy",
|
|
16
|
+
version="1.0.0",
|
|
17
|
+
author="JA3FR",
|
|
18
|
+
author_email="",
|
|
19
|
+
description="Python CFFI bindings for libcurl",
|
|
20
|
+
long_description="Fast and reliable HTTP client for Python using libcurl",
|
|
21
|
+
url="https://github.com/hhvvm1",
|
|
22
|
+
license="MIT",
|
|
23
|
+
|
|
24
|
+
packages=["clodpy"],
|
|
25
|
+
package_dir={"clodpy": "clodpy"},
|
|
26
|
+
|
|
27
|
+
ext_modules=[
|
|
28
|
+
Extension(
|
|
29
|
+
"clodpy._cld_nat",
|
|
30
|
+
sources=[
|
|
31
|
+
"nat/cld.c",
|
|
32
|
+
"nat/bnd.c"
|
|
33
|
+
],
|
|
34
|
+
include_dirs=["nat"],
|
|
35
|
+
libraries=libraries,
|
|
36
|
+
library_dirs=[],
|
|
37
|
+
)
|
|
38
|
+
],
|
|
39
|
+
|
|
40
|
+
classifiers=[
|
|
41
|
+
"Development Status :: 4 - Beta",
|
|
42
|
+
"Intended Audience :: Developers",
|
|
43
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
44
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
45
|
+
"License :: OSI Approved :: MIT License",
|
|
46
|
+
"Programming Language :: Python :: 3",
|
|
47
|
+
"Programming Language :: Python :: 3.6",
|
|
48
|
+
"Programming Language :: Python :: 3.7",
|
|
49
|
+
"Programming Language :: Python :: 3.8",
|
|
50
|
+
"Programming Language :: Python :: 3.9",
|
|
51
|
+
"Programming Language :: Python :: 3.10",
|
|
52
|
+
"Programming Language :: Python :: 3.11",
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
python_requires=">=3.6",
|
|
56
|
+
install_requires=["cffi>=1.15.0"],
|
|
57
|
+
setup_requires=["cffi>=1.15.0"],
|
|
58
|
+
|
|
59
|
+
keywords="http https curl networking web requests",
|
|
60
|
+
project_urls={
|
|
61
|
+
"Bug Reports": "https://github.com/hhvvm1",
|
|
62
|
+
"Source": "https://github.com/hhvvm1",
|
|
63
|
+
},
|
|
64
|
+
)
|