# IoTPy

> Internet of Things with Python

## IoTPy Framework

Clone the IoTPy Workshop Git Repository

```
root@platform:~# git clone https://github.com/TheIoTLearningInitiative/InternetOfThings101.git
```

Enable IoTPy Workshop credentials

```
root@platform:~# cd InternetOfThings101/code/iotpy
root@platform:~/InternetOfThings101/code/iotpy# mkdir configuration
root@platform:~/InternetOfThings101/code/iotpy# nano configuration/credentials

# IoTPy File Configuration

# Go to https://plot.ly and sign up
# Get your Username and API Key under Settings -> API Settings -> API
# Get 3 Stream Tokens under Settings -> API Settings -> Streaming API -> Generate Token
[plotly]
username = 
apikey = 
streamtoken = 
streamtokentx = 
streamtokenrx = 

# Go to dev.twitter.com and sign up
# Go to Tools -> Manage Your Apps (Application Management)
# Create a New Application and go to "Keys and Access Tokens" tab
# Generate and get under Application Settings section
# Consumer Key (API Key), Consumer Secret (API Secret)
# Generate and get under Your Access Token section
# Access Token and Access Token Secret
# Give Access Level "Read and Write"
[twitter]
consumer_key = 
consumer_secret = 
access_token = 
access_token_secret = 

# Go to www.voicerss.org and sign up
# Go to API -> Get API Key
# 
[voicerss]
apikey = 

# Go to market.mashape.com and sign up
# Search for VoiceRss API and click on it
# Copy your VoiceRss API Key and paste under "URL PARAMETERS key QUERY AUTH" field
# Fill out Form Encoded Parameters and Test EndPoint using Curl method
# Copy the generated Mashape Key
[mashape]
mashapekey = 

# End of File

root@platform:~/InternetOfThings101/code/iotpy# echo voicerssmashapekey > configuration/voicerss.ak
root@platform:~/InternetOfThings101/code/iotpy# echo voicerssapikey > configuration/voicerss.mk    
```

Run IoTPy Modules

```
root@platform:~/InternetOfThings101/code/iotpy# python main.py -m aio
root@platform:~/InternetOfThings101/code/iotpy# python main.py -m bpta
root@platform:~/InternetOfThings101/code/iotpy# python main.py -m gpio    
root@platform:~/InternetOfThings101/code/iotpy# python main.py -m mqttpub # IoTPy/Temperature
root@platform:~/InternetOfThings101/code/iotpy# python main.py -m mqttsub
root@platform:~/InternetOfThings101/code/iotpy# python main.py -m mraa
root@platform:~/InternetOfThings101/code/iotpy# time python main.py -m opencv
```

Run IoTPy Projects

```
root@platform:~/InternetOfThings101/code/iotpy# python main.py -p alive # Audio, Twitter
root@platform:~/InternetOfThings101/code/iotpy# python main.py -p climate # BMP180, PlotLy, https://plot.ly/~TheIoTLearningInitiative
root@platform:~/InternetOfThings101/code/iotpy# python main.py -p selfie # Camera, Twitter
root@platform:~/InternetOfThings101/code/iotpy# python main.py -p system # Network, Plotly, https://plot.ly/~TheIoTLearningInitiative
root@platform:~/InternetOfThings101/code/iotpy# python main.py -p weather # Audio, Pywapi
```

IoTPy Online Resources

* [UPM Python Examples](https://github.com/intel-iot-devkit/upm/tree/master/examples/python)
