Commit graph

21 commits

Author SHA1 Message Date
Pēteris Caune
232f534bc0
Improve type hints in hc.lib.curl 2023-10-25 14:47:52 +03:00
Pēteris Caune
5911075282
Fix HTTP verb in hc.lib.curl.post 2023-10-22 12:38:44 +03:00
Pēteris Caune
470f70b164
Update curl.get and curl.post to closer match requests fn signatures
In requests, "params" is a positional argument for the get function:

    requests.get(url, params=None, **kwargs)

So I made params positional here too.

In requests, "data" is a positional argument for the post function:

    requests.post(url, data=None, json=None, **kwargs)

So I data positional here too.
2023-10-21 11:45:45 +03:00
Pēteris Caune
7c7774d18c
Replace **kwargs with explicit keyword arguments in hc.lib.curl
This makes the code more verbose, but at the same time
makes type hinting cleaner, and allows mock autospeccing
to catch more problems.
2023-10-21 11:21:42 +03:00
Pēteris Caune
52ab8c4703
Improve type hints in hc.lib.curl and hc.api.transports
This results in changes in other places too:

* curl.post() does not accept `data` as positional arg,
  it must now be a keyword argument
* we need asserts and if clauses in a few places to make sure
  we are not passing `None` in the arguments to hc.lib.curl.request
2023-10-20 19:11:08 +03:00
Pēteris Caune
477f690057
Improve type hints 2023-08-31 14:17:08 +03:00
Pēteris Caune
19383d0414
Improve the error message about rejected private IPs 2023-02-03 10:08:06 +02:00
Pēteris Caune
161430fb10
Sort imports and add "from __future__ import annotations" 2022-10-17 16:52:15 +03:00
Pēteris Caune
3b137df825
Fix latin-1 handling in headers 2022-08-18 10:49:28 +03:00
Pēteris Caune
3a8b6ef51e
Add NOSIGNAL=1 option
Required when using pycurl from multiple threads [1]. Not sure if
we are but better safe than sorry.

[1] http://pycurl.io/docs/latest/thread-safety.html
2022-08-18 09:55:40 +03:00
Pēteris Caune
f69a1975e3
Improve error handling 2022-08-17 14:39:29 +03:00
Pēteris Caune
218798b8d2
Fix mypy warnings 2022-08-17 14:21:00 +03:00
Pēteris Caune
7695010398
Document hc.lib.curl.request 2022-08-17 13:07:20 +03:00
Pēteris Caune
3a50396806
Switch from requests to pycurl in integration onboarding views 2022-08-17 12:02:06 +03:00
Pēteris Caune
86e364eb24
Fix hc.lib.curl to send Content-Length header 2022-08-17 10:32:52 +03:00
Pēteris Caune
61a0cf9c2f
Fix Content-Type header when uploading JSON data 2022-08-17 10:11:18 +03:00
Pēteris Caune
fc127e3c01
Fix non-ASCII character handling in URLs 2022-08-17 09:22:30 +03:00
Pēteris Caune
e156c6bcae
Fix hc.lib.curl.request to handle the "auth" kwarg 2022-08-16 12:46:22 +03:00
Pēteris Caune
62acb04bba
Fix hc.lib.curl.request to handle the "params" kwarg 2022-08-16 12:28:53 +03:00
Pēteris Caune
64bb43f74f
Limit allowed protocols, add INTEGRATIONS_ALLOW_PRIVATE_IPS setting 2022-08-16 11:13:14 +03:00
Pēteris Caune
41428d1dee
Switch transports from requests to pycurl
With requests, there is no clean way to set a time limit
on a single HTTP request:  https://stackoverflow.com/a/71453648/5821
2022-08-16 09:17:57 +03:00