Skip to content

Instantly share code, notes, and snippets.

@MayankPratap
Last active May 15, 2017 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MayankPratap/a6616b35a9bad02f84632c77601769aa to your computer and use it in GitHub Desktop.
Save MayankPratap/a6616b35a9bad02f84632c77601769aa to your computer and use it in GitHub Desktop.
runs on raspberry pi takes pic and sends it to bot server ( Currently picture capturing part is not shown)
# This used Python simpleHTTPServer to host files and then tunnel using ngrok to get public ip
# Then i get url of images hosted on local server.
import requests
import json
import pickle
from time import sleep
#url="https://api.imageshack.com/v2/images"
#api_key="DEGHSVWY76e25bee3b8a24d32568a646e4657e9b"
image_url="https://c4628358.ngrok.io/10.jpg"
url2='https://robotic-messenger.herokuapp.com/gotsomepic'
data={'image_url':image_url}
data=json.dumps(data)
r=requests.post(url2,data=data)
#print(r.text)
#print("Raula")
#sleep(1)
print("Getting user's reply")
url2='https://robotic-messenger.herokuapp.com/userReply'
r=requests.get(url2)
#cnt=0
#userNotReply=True
while r.text=="":
#cnt+=1
sleep(1)
r=requests.get(url2)
print(r.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment