Curl error when downloading json object
<p>getting the following error...</p>

<pre><code>curl: (56) GnuTLS recv error (-54): Error in the pull function.
</code></pre>

<p>...when using the following command to curl a json file</p>

<pre><code>curl -L -o commerce.json http://www.commerce.gov/data.json
</code></pre>

<p>Any advice? I'm not familiar with curl. Perhaps it's a timeout error. Is there anyway I can prevent that? I really need the file, and I am unable to download it from a browser (assuming too big a file).</p>

<p>I'm working from command line on Ubuntu. Would love, alternatively to curl, a python solution.</p>

<p>In bash you can use:</p>

<pre><code>wget -O commerce.json http://www.commerce.gov/data.json
</code></pre>

<p>Otherwise, a Python solution to this would be:</p>

<p>First you will need to install the Python <code>wget</code> library, then you can use the code:</p>

<pre><code>import wget
url = 'http://www.commerce.gov/data.json'

commercejson = wget.download(url)
</code></pre>

<p>This will download the <code>data.json</code> file to your local Python project directory.
The <code>data.json</code> file is currently 198MB, so curl may not be able to handle it very well.</p>

<p><strong>UPDATE: Compressed JSON download:</strong></p>

<p>To enable gzip compression, you can use the following to download gzipped version, which ends up being 19MB instead, which would be much more friendly to download.</p>

<pre><code>wget -S --header="accept-encoding: gzip" -O commerce.json.gz http://www.commerce.gov/data.json
</code></pre>

<p>Then, once the gzipped json file is downloaded, run the below command to decompress it:</p>

<p><code>gzip -d commerce.json.gz</code></p>

python json bash curl