Created
May 2, 2017 14:55
-
-
Save MayankPratap/fa8d79cc76de57dd3eee99631adf9938 to your computer and use it in GitHub Desktop.
takes pic through picamera and sends to bot server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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