Skip to content

Commit ddc4f44

Browse files
committed
pycurl is to much of hassle to install
1 parent c8609a2 commit ddc4f44

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

CHANGELOG.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## 2.4.0 - 2021-02-22
88

9-
### Added
10-
- Can now use STREAM=pycurl as environment variable to download file
11-
using pycurl instead of requests. Sometimes requests hangs when
12-
setting up a SSL connection.
13-
149
### Changed
1510
- clowder is no longer the default exchange. Exchanges are no longer used and
1611
this is deprecated.

pyclowder/files.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
import requests
1212
from requests_toolbelt.multipart.encoder import MultipartEncoder
13-
import pycurl
14-
import certifi
1513
from urllib3.filepost import encode_multipart_formdata
1614

1715
from pyclowder.datasets import get_file_list
@@ -46,26 +44,15 @@ def download(connector, host, key, fileid, intermediatefileid=None, ext=""):
4644
intermediatefileid = fileid
4745

4846
url = '%sapi/files/%s?key=%s' % (host, intermediatefileid, key)
47+
result = connector.get(url, stream=True, verify=connector.ssl_verify if connector else True)
48+
4949
(inputfile, inputfilename) = tempfile.mkstemp(suffix=ext)
5050

5151
try:
52-
if os.getenv('STREAM', '').lower() == 'pycurl':
53-
with os.fdopen(inputfile, "wb") as outputfile:
54-
c = pycurl.Curl()
55-
if connector and not connector.ssl_verify:
56-
c.setopt(pycurl.SSL_VERIFYPEER, 0)
57-
c.setopt(pycurl.SSL_VERIFYHOST, 0)
58-
c.setopt(c.URL, url)
59-
c.setopt(c.WRITEDATA, outputfile)
60-
c.setopt(c.CAINFO, certifi.where())
61-
c.perform()
62-
c.close()
63-
else:
64-
result = connector.get(url, stream=True, verify=connector.ssl_verify if connector else True)
65-
with os.fdopen(inputfile, "wb") as outputfile:
66-
for chunk in result.iter_content(chunk_size=10 * 1024):
67-
outputfile.write(chunk)
68-
return inputfilename
52+
with os.fdopen(inputfile, "wb") as outputfile:
53+
for chunk in result.iter_content(chunk_size=10*1024):
54+
outputfile.write(chunk)
55+
return inputfilename
6956
except Exception:
7057
os.remove(inputfilename)
7158
raise

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ pika==1.1.0
33
PyYAML==5.1
44
requests==2.24.0
55
requests-toolbelt==0.9.1
6-
pycurl==7.43.0.6

0 commit comments

Comments
 (0)