(args: argparse.Namespace)
| 261 | |
| 262 | |
| 263 | def make_default_headers(args: argparse.Namespace) -> HTTPHeadersDict: |
| 264 | default_headers = HTTPHeadersDict({ |
| 265 | 'User-Agent': DEFAULT_UA |
| 266 | }) |
| 267 | |
| 268 | auto_json = args.data and not args.form |
| 269 | if args.json or auto_json: |
| 270 | default_headers['Accept'] = JSON_ACCEPT |
| 271 | if args.json or (auto_json and args.data): |
| 272 | default_headers['Content-Type'] = JSON_CONTENT_TYPE |
| 273 | |
| 274 | elif args.form and not args.files: |
| 275 | # If sending files, `requests` will set |
| 276 | # the `Content-Type` for us. |
| 277 | default_headers['Content-Type'] = FORM_CONTENT_TYPE |
| 278 | return default_headers |
| 279 | |
| 280 | |
| 281 | def make_send_kwargs(args: argparse.Namespace) -> dict: |
no test coverage detected