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

Commit aeff51b

Browse files
committed
Fixed documentation - thanks hlx98007 for pointing this out
1 parent f060792 commit aeff51b

3 files changed

Lines changed: 57 additions & 9 deletions

File tree

CloudFlare/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
from cloudflare import CloudFlare
44

5-
__version__ = '1.1.3'
5+
__version__ = '1.1.4'

README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,29 @@ if __name__ == '__main__':
104104

105105
## Providing CloudFlare Username and API Key
106106

107-
When you create a _CloudFlare_ class you can pass up to three paramaters.
107+
When you create a _CloudFlare_ class you can pass up to four paramaters.
108108

109109
* Account email
110110
* Account API key
111+
* Optional Origin-CA Certificate Token
111112
* Optional Debug flag (True/False)
112113

114+
```python
115+
import CloudFlare
116+
117+
# A minimal call - reading values from environment variables or configuration file
118+
cf = CloudFlare.CloudFlare()
119+
120+
# A minimal call with debug enabled
121+
cf = CloudFlare.CloudFlare(debug=True))
122+
123+
# A full blown call with passed basic account information
124+
cf = CloudFlare.CloudFlare(email='user@example.com', token='00000000000000000000000000000000')
125+
126+
# A full blown call with passed basic account information and CA-Origin info
127+
cf = CloudFlare.CloudFlare(email='user@example.com', token='00000000000000000000000000000000', certtoken='v1.0-...')
128+
```
129+
113130
If the account email and API key are not passed when you create the class, then they are retreived from either the users exported shell environment variables or the .cloudflare.cfg or ~/.cloudflare.cfg or ~/.cloudflare/cloudflare.cfg files, in that order.
114131

115132
There is one call that presently doesn't need any email or token certification (the */ips* call); hence you can test without any values saved away.
@@ -122,6 +139,8 @@ $ export CF_API_CERTKEY='v1.0-...'
122139
$
123140
```
124141

142+
These are optional environment variables; however, they do override the values set within a configuration file.
143+
125144
### Using configuration file to store email and keys
126145

127146
```bash
@@ -134,7 +153,12 @@ extras =
134153
$
135154
```
136155

137-
The *CF_API_CERTKEY* or *certtoken* values are used for the Origin-CA */certificates* API calls. At the time of being, you must leave extras in the configuration, the value can be left blank.
156+
The *CF_API_CERTKEY* or *certtoken* values are used for the Origin-CA */certificates* API calls.
157+
You can leave *certtoken* in the configuration with a blank value (or omit the option variable fully).
158+
159+
The *extras* values are used when adding API calls outside of the core codebase.
160+
Technically, this is only useful for internal testing within CloudFlare.
161+
You can leave *extras* in the configuration with a blank value (or omit the option variable fully).
138162

139163
## Included example code
140164

@@ -374,7 +398,7 @@ Extra API calls can be added via the configuration file
374398
```bash
375399
$ cat ~/.cloudflare/cloudflare.cfg
376400
[CloudFlare]
377-
extras=
401+
extras =
378402
/client/v4/command
379403
/client/v4/command/:command_identifier
380404
/client/v4/command/:command_identifier/settings

README.rst

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,29 @@ A more complex example follows.
114114
Providing CloudFlare Username and API Key
115115
-----------------------------------------
116116

117-
When you create a *CloudFlare* class you can pass up to three
118-
paramaters.
117+
When you create a *CloudFlare* class you can pass up to four paramaters.
119118

120119
- Account email
121120
- Account API key
121+
- Optional Origin-CA Certificate Token
122122
- Optional Debug flag (True/False)
123123

124+
.. code:: python
125+
126+
import CloudFlare
127+
128+
# A minimal call - reading values from environment variables or configuration file
129+
cf = CloudFlare.CloudFlare()
130+
131+
# A minimal call with debug enabled
132+
cf = CloudFlare.CloudFlare(debug=True))
133+
134+
# A full blown call with passed basic account information
135+
cf = CloudFlare.CloudFlare(email='user@example.com', token='00000000000000000000000000000000')
136+
137+
# A full blown call with passed basic account information and CA-Origin info
138+
cf = CloudFlare.CloudFlare(email='user@example.com', token='00000000000000000000000000000000', certtoken='v1.0-...')
139+
124140
If the account email and API key are not passed when you create the
125141
class, then they are retreived from either the users exported shell
126142
environment variables or the .cloudflare.cfg or ~/.cloudflare.cfg or
@@ -140,6 +156,9 @@ Using shell environment variables
140156
$ export CF_API_CERTKEY='v1.0-...'
141157
$
142158
159+
These are optional environment variables; however, they do override the
160+
values set within a configuration file.
161+
143162
Using configuration file to store email and keys
144163
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145164

@@ -154,8 +173,13 @@ Using configuration file to store email and keys
154173
$
155174
156175
The *CF\_API\_CERTKEY* or *certtoken* values are used for the Origin-CA
157-
*/certificates* API calls. At the time of being, you must leave extras
158-
in the configuration, the value can be left blank.
176+
*/certificates* API calls. You can leave *certtoken* in the
177+
configuration with a blank value (or omit the option variable fully).
178+
179+
The *extras* values are used when adding API calls outside of the core
180+
codebase. Technically, this is only useful for internal testing within
181+
CloudFlare. You can leave *extras* in the configuration with a blank
182+
value (or omit the option variable fully).
159183

160184
Included example code
161185
---------------------
@@ -478,7 +502,7 @@ Extra API calls can be added via the configuration file
478502
479503
$ cat ~/.cloudflare/cloudflare.cfg
480504
[CloudFlare]
481-
extras=
505+
extras =
482506
/client/v4/command
483507
/client/v4/command/:command_identifier
484508
/client/v4/command/:command_identifier/settings

0 commit comments

Comments
 (0)