Build HTTP headers for outbound Dispatcharr requests. content_type=None omits Content-Type (e.g. simple GET proxies). token is included when authenticating with Schedules Direct.
(*, token=None, content_type='application/json')
| 34 | |
| 35 | |
| 36 | def dispatcharr_http_headers(*, token=None, content_type='application/json'): |
| 37 | """ |
| 38 | Build HTTP headers for outbound Dispatcharr requests. |
| 39 | |
| 40 | content_type=None omits Content-Type (e.g. simple GET proxies). |
| 41 | token is included when authenticating with Schedules Direct. |
| 42 | """ |
| 43 | headers = {'User-Agent': dispatcharr_user_agent()} |
| 44 | if content_type: |
| 45 | headers['Content-Type'] = content_type |
| 46 | if token: |
| 47 | headers['token'] = token |
| 48 | return headers |
| 49 | |
| 50 | |
| 51 | def natural_sort_key(text): |