Skip to content

Instantly share code, notes, and snippets.

@MayankPratap
Created May 2, 2017 14:55
Show Gist options
  • Save MayankPratap/fa8d79cc76de57dd3eee99631adf9938 to your computer and use it in GitHub Desktop.
Save MayankPratap/fa8d79cc76de57dd3eee99631adf9938 to your computer and use it in GitHub Desktop.
takes pic through picamera and sends to bot server
# 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://90ae1045.ngrok.io/elonmusk.jpg"
url2='https://8b4e0387.ngrok.io/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='/userReply'
r=requests.get(url2)
#cnt=0
#userNotReply=True
while r.text=="":
sleep(4)
#cnt+=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