Register for a PiCloud account if you have not done so already.
Download and Install the PiCloud client.
Retrieve your PiCloud API key information.
Run Python:
python
Import the client-side interface:
>>> import cloud
Connect to the PiCloud server:
>>> cloud.setkey(api_key=your_api_key, api_secretkey='your_api_secretkey')
e.g. for api_key =3 and api_secretkey =18b73de563c18c20582cd0315d20533a8c9bd038:
>>> cloud.setkey(api_key=3, api_secretkey='18b73de563c18c20582cd0315d20533a8c9bd038')
You can now run arbitrary functions on PiCloud:
>> jid = cloud.call(lambda: 3*3) #a jid identifies your job (a function)
>> cloud.result(jid)
9
>>> def square(x):
... return x*x
...
>>> jid = cloud.call(square,3)
>>> cloud.result(jid)
9
With the Jobs view, you can see a graphical report of your jobs that have run.
If the function you wish to run is CPU intensive, you may wish to run it in high CPU mode. High CPU mode costs more per minute, but your job will finish much quicker. To use this mode, set the _high_cpu keyword argument to True within the call:
>> cloud.call(square, 3, _high_cpu=True)
If you don’t want to put the setkey command in your code, you can modify cloudconf.py. This file is generated when cloud is first imported and is stored in the directory returned by cloud.getconfigpath(). Simply set the api_key and api_secretkey entries to your keys, e.g. for api_key =3 and api_secretkey =18b73de563c18c20582cd0315d20533a8c9bd038:
"""
Account
"""
# your application's api key provided by PiCloud
api_key = 3
# your application's secret key provided by cloud
api_secretkey = '18b73de563c18c20582cd0315d20533a8c9bd038'