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

Commit 5f06e8a

Browse files
committed
config file allows a per-method values
1 parent 1a684ae commit 5f06e8a

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,35 @@ def main():
265265
...
266266
```
267267

268+
### Advanced use of configuration file for authentication based on method
269+
270+
The configuration file can have values that are both generic and specific to the method.
271+
Here's an example where a project has a different API Token for reading and writing values.
272+
273+
```bash
274+
$ cat ~/.cloudflare/cloudflare.cfg
275+
[Work]
276+
token = 0000000000000000000000000000000000000000
277+
token.get = 0123456789012345678901234567890123456789
278+
$
279+
```
280+
281+
When a GET call is processed then the second token is used. For all other calls the first token is used.
282+
Here's a more explict verion of that config:
283+
284+
```bash
285+
$ cat ~/.cloudflare/cloudflare.cfg
286+
[Work]
287+
token.delete = 0000000000000000000000000000000000000000
288+
token.get = 0123456789012345678901234567890123456789
289+
token.patch = 0000000000000000000000000000000000000000
290+
token.post = 0000000000000000000000000000000000000000
291+
token.put = 0000000000000000000000000000000000000000
292+
$
293+
```
294+
295+
This can be used with email values also.
296+
268297
### About /certificates and certtoken
269298

270299
The *CF_API_CERTKEY* or *certtoken* values are used for the Origin-CA */certificates* API calls.

README.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,38 @@ Here is the same in code.
303303
cf = CloudFlare.CloudFlare(profile="Work")
304304
...
305305
306+
Advanced use of configuration file for authentication based on method
307+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308+
309+
The configuration file can have values that are both generic and
310+
specific to the method. Here's an example where a project has a
311+
different API Token for reading and writing values.
312+
313+
.. code:: bash
314+
315+
$ cat ~/.cloudflare/cloudflare.cfg
316+
[Work]
317+
token = 0000000000000000000000000000000000000000
318+
token.get = 0123456789012345678901234567890123456789
319+
$
320+
321+
When a GET call is processed then the second token is used. For all
322+
other calls the first token is used. Here's a more explict verion of
323+
that config:
324+
325+
.. code:: bash
326+
327+
$ cat ~/.cloudflare/cloudflare.cfg
328+
[Work]
329+
token.delete = 0000000000000000000000000000000000000000
330+
token.get = 0123456789012345678901234567890123456789
331+
token.patch = 0000000000000000000000000000000000000000
332+
token.post = 0000000000000000000000000000000000000000
333+
token.put = 0000000000000000000000000000000000000000
334+
$
335+
336+
This can be used with email values also.
337+
306338
About /certificates and certtoken
307339
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308340

0 commit comments

Comments
 (0)