Skip to content

Commit

Permalink
Merge pull request #26 from kylestev/patch-1
Browse files Browse the repository at this point in the history
Fixed example syntax
  • Loading branch information
koalalorenzo committed Mar 19, 2014
2 parents 5b35122 + 784311e commit 4ab511e
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,37 @@ python-digitalocean support all the features provided via digitalocean.com APIs,

This example shows how to shutdown all the active droplets:

import digitalocean
manager = digitalocean.Manager(client_id="ABC", api_key="ABC")
my_droplets = manager.get_all_droplets()
for droplet in my_droplets:
droplet.shutdown()
```python
import digitalocean
manager = digitalocean.Manager(client_id="ABC", api_key="ABC")
my_droplets = manager.get_all_droplets()
for droplet in my_droplets:
droplet.shutdown()
```

### Creating a Droplet and checking its status

This example shows how to create a droplet and how to check its status

import digitalocean
droplet = digitalocean.Droplet(client_id=client_id,
api_key=api_key,
name = 'Example',
region_id=1 #New York,
image_id=2676 #Ubuntu 12.04 x64 Server,
size_id=66 #512MB,
backup_active=False)
droplet.create()
```python
import digitalocean
droplet = digitalocean.Droplet(client_id=client_id, api_key=api_key,
name='Example',
region_id=1, # New York
image_id=2676, # Ubuntu 12.04 x64 Server
size_id=66, # 512MB
backup_active=False)
droplet.create()
```

### Checking the status of the droplet
events = droplet.get_events()
for event in events:
event.load()
#Once it shows 100, droplet is up and running
print event.percentage
```python
events = droplet.get_events()
for event in events:
event.load()
# Once it shows 100, droplet is up and running
print event.percentage
```

## Links

Expand Down

0 comments on commit 4ab511e

Please sign in to comment.