Comments (10)
Your SiriAPI installation is located in the directory /home/Siri-API, right? Does exist the file proxy.pac there? Normally it is downloaded when you clone the repo.
from siri-api.
Yes the proxy.pac file is there.I even tried again as root but no success.
from siri-api.
What happens when you try to open the file (using an editor such as nano, vi or gedit)?
from siri-api.
I am able to open it.I think I made a mistake when writing the directory on the sever.py.but I don't know how I should write it
from siri-api.
I managed to get passed that error now when I call Google Siri terminal returns this:
proxy.pac
192.168.0.103 - - [06/Aug/2014 05:57:07] "GET /proxy.pac HTTP/1.1" 400 -
from siri-api.
I am able to open it.I think I made a mistake when writing the directory on the sever.py.but I don't know how I should write it
Which directory do you mean? Normally you don't have to change any directory in the server.py
from siri-api.
Thanks I realized that I made a mistake.I restored the orginal sever.py but when I run it get this:
pi@raspberrypi ~ $ sudo python3 /home/Siri-API/server.py
File "/home/Siri-API/server.py", line 24
def do_HEAD(self):
^
SyntaxError: invalid character in identifier
from siri-api.
That's strange. Can you post the content of server.py in code tags please. You can find the instructions for using code tags here: https://help.github.com/articles/github-flavored-markdown
Which Python version do you use? I remember issues with a python 3 subversion in an earlier issue. Maybe it is again something like in incompatibility error.
from siri-api.
Sorry for the delay I had to re install raspbian.Therfore I reinstaled Siri API.Now the server.py runs smothly.
Here is the server.py:
import http.server
import socketserver
import threading
import time
import os
from commands import commands
from search import search
######################
# Configuration area #
######################
squid_hostname = "192.168.0.11" # Hostname or IP address of the server which is running squid proxy
squid_port = 3128 # Port of squid (change only if you changed it in squid configuration)
google_domain = ".google.com" # Domain of "the" Google which is opened from your language. Consult readme for more information
keyword = "Siri" # By default this is siri. You can change this to any other (well recognized) keyword, CASE SENSITIVE!!!
######################
os.chdir(os.path.dirname(os.path.abspath(__file__))) # Set working directory to path of server.py
class Handler(http.server.SimpleHTTPRequestHandler):
def do_HEAD(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
def do_GET(self):
global squid_hostname
global squid_port
global google_domain
global keyword
parts = self.path.split("?") #Extract requested file and get parameters from path
path = parts[0]
#Extract variables from get parameters
try:
arguments = {}
arguments["q"] = None #Variable for search request. Default None to prevent errors if no search request was started
if (len(parts) > 1):
raw_arguments = parts[1].split("&")
for raw_argument in raw_arguments[:]:
argument = raw_argument.split("=", 1)
arguments[argument[0]] = argument[1]
except:
print ("No get parameters")
print (path)
#Decide wether a search or the style.css was requested
if (path == "/style.css"):
self.document = open('style.css', 'r').read()
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(bytes(self.document, "utf-8"))
elif (path == "/proxy.pac"):
self.document = open('proxy.pac', 'r').read()
self.document = self.document.replace('<keyword>', keyword.lower(), 1)
self.document = self.document.replace('<google_domain>', google_domain, 1)
self.document = self.document.replace('<squid_host>', squid_hostname, 1)
self.document = self.document.replace('<squid_port>', str(squid_port), 1)
self.send_response(200)
self.send_header('Content-type', 'x-ns-proxy-autoconfig')
self.end_headers()
self.wfile.write(bytes(self.document, "utf-8"))
elif (arguments["q"] != None):
arguments["q"] = arguments["q"].replace(keyword + '+', '', 1)
arguments["q"] = arguments["q"].replace('+', ' ')
command = commands(self)
search(command).search(arguments["q"])
else:
self.send_response(404)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(bytes('Not found. Please visit <a href="https://github.com/HcDevel/Siri-API/wiki/_pages">https://github.com/HcDevel/Siri-API/wiki/_pages</a>', "utf-8"))
return
port = 3030
print ("Starting Server...")
exception = True
while (exception == True): #Solves trouble in autostart mode (when network isn't ready)
try:
#(Try) to start webserver
httpd = socketserver.TCPServer(('', port), Handler)
threading.Thread(target=httpd.serve_forever).start()
print('Server listening on port ' + str(port) + '...')
exception = False
except:
print ("Error: Webserver can't be started")
time.sleep (1)
input ("Press enter to exit")
print ("Shutting down server ...")
httpd.shutdown()
httpd.server_close()
And terminal shows up this:
pi@raspberrypi /home/Siri-API $ sudo python3 server.py
Starting Server...
Server listening on port 3030...
Press enter to exit/
192.168.0.15 - - [11/Aug/2014 04:45:49] "GET / HTTP/1.1" 404 -
/proxy.pac
192.168.0.15 - - [11/Aug/2014 04:45:51] "GET /proxy.pac HTTP/1.1" 200 -
It`s just like before except that when I try to run Squid I get this:
pi@raspberrypi /home/Siri-API $ sudo /usr/local/squid/sbin/squid -NCd9
2014/08/11 04:56:48| SECURITY NOTICE: auto-converting deprecated "ssl_bump allow <acl>" to "ssl_bump client-first <acl>" which is usually inferior to the newer server-first bumping mode. Update your ssl_bump rules.
2014/08/11 04:56:48| WARNING: auto-converting deprecated "ssl_bump deny <acl>" to "ssl_bump none <acl>". Update your ssl_bump rules.
Thanks for your help
from siri-api.
Squid only shows the message because of its configuration. This is no problem but I should upgrade the configuration to prevent future problems
from siri-api.
Related Issues (20)
- Siri internal Bing search?? HOT 2
- Squid dosent start on startup HOT 2
- Voice feedback support HOT 3
- Google Siri turn on light one dont work HOT 1
- Squid The requested url could not be retrieved HOT 1
- Issue with iOS8 HOT 6
- google normally appears HOT 65
- Squid does not forward to Siri-API HOT 1
- plugin for siri api HOT 1
- Siri API installation on RPi HOT 1
- This page is unavailable HOT 5
- afetr run Squid ... HOT 8
- https resquest HOT 1
- Html respond auto close HOT 5
- add command HOT 13
- Deal with upper and lower cases HOT 6
- Using wildcard for the first search word does not work HOT 10
- Search defect HOT 2
- Problem with Raspberry Pi and Python HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from siri-api.