Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 08123c1

Browse files
committed
http_headers documentation
1 parent 44751a0 commit 08123c1

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,42 @@ def main():
319319
...
320320
```
321321

322+
### Passing your own HTTP headers to API calls
323+
324+
There are very specific case where a user of the library needs to add custom headers to all HTTP calls.
325+
This is rarly needed.
326+
327+
The addition headers can be passed via the confuration file as follows:
328+
329+
```bash
330+
$ cat ~/.cloudflare/cloudflare.cfg
331+
...
332+
http_headers =
333+
X-Header1:value
334+
X-Header2: value1 value2 value3
335+
X-Header3: "this is life as we know it"
336+
X-Header4: 'two single quotes'
337+
X-Header5:
338+
...
339+
$
340+
```
341+
Each line should have a header noun, a colon, and a verb.
342+
343+
You can also pass these via Python calls.
344+
```python
345+
import CloudFlare
346+
347+
http_headers = [
348+
'X-Header1:value',
349+
'X-Header2: value1 value2 value3',
350+
'X-Header3: "this is life as we know it"',
351+
'X-Header4: \'two single quotes\'',
352+
'X-Header5:',
353+
]
354+
cf = CloudFlare.CloudFlare(http_headers=http_headers)
355+
...
356+
```
357+
322358
### Advanced use of configuration file for authentication based on method
323359

324360
The configuration file can have values that are both generic and specific to the method.

0 commit comments

Comments
 (0)