Skip to content

Commit

Permalink
Fixed documentation - thanks hlx98007 for pointing this out
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Jun 22, 2016
1 parent f060792 commit aeff51b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CloudFlare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from cloudflare import CloudFlare

__version__ = '1.1.3'
__version__ = '1.1.4'
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,29 @@ if __name__ == '__main__':

## Providing CloudFlare Username and API Key

When you create a _CloudFlare_ class you can pass up to three paramaters.
When you create a _CloudFlare_ class you can pass up to four paramaters.

* Account email
* Account API key
* Optional Origin-CA Certificate Token
* Optional Debug flag (True/False)

```python
import CloudFlare

# A minimal call - reading values from environment variables or configuration file
cf = CloudFlare.CloudFlare()

# A minimal call with debug enabled
cf = CloudFlare.CloudFlare(debug=True))

# A full blown call with passed basic account information
cf = CloudFlare.CloudFlare(email='user@example.com', token='00000000000000000000000000000000')

# A full blown call with passed basic account information and CA-Origin info
cf = CloudFlare.CloudFlare(email='user@example.com', token='00000000000000000000000000000000', certtoken='v1.0-...')
```

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.

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.
Expand All @@ -122,6 +139,8 @@ $ export CF_API_CERTKEY='v1.0-...'
$
```

These are optional environment variables; however, they do override the values set within a configuration file.

### Using configuration file to store email and keys

```bash
Expand All @@ -134,7 +153,12 @@ extras =
$
```

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.
The *CF_API_CERTKEY* or *certtoken* values are used for the Origin-CA */certificates* API calls.
You can leave *certtoken* in the configuration with a blank value (or omit the option variable fully).

The *extras* values are used when adding API calls outside of the core codebase.
Technically, this is only useful for internal testing within CloudFlare.
You can leave *extras* in the configuration with a blank value (or omit the option variable fully).

## Included example code

Expand Down Expand Up @@ -374,7 +398,7 @@ Extra API calls can be added via the configuration file
```bash
$ cat ~/.cloudflare/cloudflare.cfg
[CloudFlare]
extras=
extras =
/client/v4/command
/client/v4/command/:command_identifier
/client/v4/command/:command_identifier/settings
Expand Down
34 changes: 29 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,29 @@ A more complex example follows.
Providing CloudFlare Username and API Key
-----------------------------------------

When you create a *CloudFlare* class you can pass up to three
paramaters.
When you create a *CloudFlare* class you can pass up to four paramaters.

- Account email
- Account API key
- Optional Origin-CA Certificate Token
- Optional Debug flag (True/False)

.. code:: python
import CloudFlare
# A minimal call - reading values from environment variables or configuration file
cf = CloudFlare.CloudFlare()
# A minimal call with debug enabled
cf = CloudFlare.CloudFlare(debug=True))
# A full blown call with passed basic account information
cf = CloudFlare.CloudFlare(email='user@example.com', token='00000000000000000000000000000000')
# A full blown call with passed basic account information and CA-Origin info
cf = CloudFlare.CloudFlare(email='user@example.com', token='00000000000000000000000000000000', certtoken='v1.0-...')
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
Expand All @@ -140,6 +156,9 @@ Using shell environment variables
$ export CF_API_CERTKEY='v1.0-...'
$
These are optional environment variables; however, they do override the
values set within a configuration file.

Using configuration file to store email and keys
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -154,8 +173,13 @@ Using configuration file to store email and keys
$
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.
*/certificates* API calls. You can leave *certtoken* in the
configuration with a blank value (or omit the option variable fully).

The *extras* values are used when adding API calls outside of the core
codebase. Technically, this is only useful for internal testing within
CloudFlare. You can leave *extras* in the configuration with a blank
value (or omit the option variable fully).

Included example code
---------------------
Expand Down Expand Up @@ -478,7 +502,7 @@ Extra API calls can be added via the configuration file
$ cat ~/.cloudflare/cloudflare.cfg
[CloudFlare]
extras=
extras =
/client/v4/command
/client/v4/command/:command_identifier
/client/v4/command/:command_identifier/settings
Expand Down

0 comments on commit aeff51b

Please sign in to comment.