Repository: spulec/uncurl

Issue:
cURL with disabled security certificate check is not parsed properly
When submitting a request to a website with an expired certificate, a ```--insecure``` flag is passed in the request, This flag is not properly parsed, as is evident in this example:

```uncurl.parse(curl "http://" --insecure)```

This returns the following:

```
requests.get("http://",
    headers={},
    cookies={},
{}verify=False
)
```

It should instead return:

```
requests.get("http://",
    headers={},
    cookies={},
    verify=False
)
```

Discussion:

Patch:
diff --git a/uncurl/api.py b/uncurl/api.py
index 4de067b..574739c 100644
--- a/uncurl/api.py
+++ b/uncurl/api.py
@@ -69,7 +69,7 @@ def parse(curl_command):
 
     verify_token = ''
     if parsed_context.verify:
-        verify_token = '\n{}verify=False'
+        verify_token = '\n{}verify=False'.format(BASE_INDENT)
 
     formatter = {
         'method': parsed_context.method,


Test patch:
diff --git a/tests/test_api.py b/tests/test_api.py
index 09a2da0..0228e2d 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -139,6 +139,16 @@ def test_parse_curl_with_another_binary_data():
 )""")
 
 
+def test_parse_curl_with_insecure_flag():
+    uncurl.parse("""curl 'https://pypi.python.org/pypi/uncurl' --insecure""").should.equal(
+        """requests.get("https://pypi.python.org/pypi/uncurl",
+    headers={},
+    cookies={},
+    verify=False
+)"""
+    )
+
+
 if __name__ == '__main__':
     test_basic_get()
     test_colon_header()
@@ -150,5 +160,6 @@ if __name__ == '__main__':
     test_post_with_string_data()
     test_parse_curl_with_binary_data()
     test_parse_curl_with_another_binary_data()
+    test_parse_curl_with_insecure_flag()