Skip to content

Instantly share code, notes, and snippets.

View jmwenda's full-sized avatar

Jude Mwenda jmwenda

View GitHub Profile
http://maps.nationmedia.com/tables/constituencies16/embed_map?title=true&description=true&search=false&shareable=true&sql=&sw_lat=-3.7327083213358336&sw_lon=24.960937499999996&ne_lat=4.3464112753331925&ne_lon=50.88867187499999
http://maps.nationmedia.com/tables/constituenciesvoterapathy/embed_map?title=true&description=true&search=false&shareable=true&sql=&sw_lat=-7.623886853120036&sw_lon=12.041015625&ne_lat=8.494104537551882&ne_lon=63.896484375
http://maps.nationmedia.com/tables/referendum2010/embed_map?title=true&description=true&search=false&shareable=false&sql=&sw_lat=-3.46955730306146&sw_lon=25.6640625&ne_lat=4.609278084409835&ne_lon=51.591796875
import requests
import os
import json
from requests.auth import HTTPBasicAuth
def upload(uploadfile,title,description):
#with the parameters we go authenticate
payload = {'username': 'jmwenda', 'password': 'blahblah','submit':'Login','api_key':'mysample'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post("https://mysourcemap.com/member/login?format=json", data=json.dumps(payload),headers=headers)
[Tue Jun 11 09:48:25 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Tue Jun 11 06:54:47 2013] [error] Internal Server Error: /layers/upload
[Tue Jun 11 06:54:47 2013] [error] Traceback (most recent call last):
[Tue Jun 11 06:54:47 2013] [error] File "/var/lib/geonode/lib/python2.7/site-packages/django/core/handlers/base.py", line 188, in get_response
[Tue Jun 11 06:54:47 2013] [error] response = middleware_method(request, response)
[Tue Jun 11 06:54:47 2013] [error] File "/var/lib/geonode/lib/python2.7/site-packages/request/middleware.py", line 27, in process_response
[Tue Jun 11 06:54:47 2013] [error] r.from_http_request(request, response)
[Tue Jun 11 06:54:47 2013] [error] File "/var/lib/geonode/lib/python2.7/site-packages/request/models.py", line 65, in from_http_request
[Tue Jun 11 06:54:47 2013] [error] self.save()
[Tue Jun 11 06:54:47 2013] [error] File "/var/lib/geonode/lib/python2.7/site-packages/django/db/models/base.py",
[Tue Aug 06 18:57:09 2013] [error] Internal Server Error: /sessions
[Tue Aug 06 18:57:09 2013] [error] Traceback (most recent call last):
[Tue Aug 06 18:57:09 2013] [error] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 92, in get_response
[Tue Aug 06 18:57:09 2013] [error] response = middleware_method(request)
[Tue Aug 06 18:57:09 2013] [error] File "/usr/lib/python2.7/dist-packages/django/middleware/common.py", line 57, in process_request
[Tue Aug 06 18:57:09 2013] [error] host = request.get_host()
[Tue Aug 06 18:57:09 2013] [error] File "/usr/lib/python2.7/dist-packages/django/http/request.py", line 72, in get_host
[Tue Aug 06 18:57:09 2013] [error] "Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host)
[Tue Aug 06 18:57:09 2013] [error] SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): mobipay.openrev.bank.io
Error generating layer aggregate statistics
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/geonode/layers/models.py", line 621, in get_attribute_statistics
return wps_execute_layer_attribute_statistics(layer_name, field)
File "/usr/local/lib/python2.7/dist-packages/geonode/layers/ows.py", line 145, in wps_execute_layer_attribute_statistics
response = http_post(url, request)
File "/usr/lib/python2.7/dist-packages/owslib/util.py", line 270, in http_post
up = urllib2.urlopen(r,timeout=timeout);
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
[failed] Layer for '/home/geonode/data/Eth_Zone_Boundary.shp'
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
curl --dump-header - -H "Content-Type: application/json" -H "X-CSRFToken: VhPYwzz4NJXnTPgkfSuSAQnN3HZ5AJj0" -H "Authorization: ApiKey jmwenda:123456789" -X POST --data '{"device": {"pk": 1}, "latitude": "latitude", "imei": "$$AF860041024247929", "time_stamp": "20140505211312", "altitude": 0, "speed": 0, "heading": "N", "longitude": "longitude"}' 'http://127.0.0.1/api/v1/devicerecord/?username=jmwenda&api_key=123456789'