This file contains 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
# Pass filename to send from the static subdirectory | |
directory = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'static' ) | |
return send_from_directory(directory, filename) |
This file contains 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
def image_path(self): | |
"""Returns the path to the images | |
""" | |
from django.conf import settings | |
if hasattr(settings,'RANDOM_IMAGE_REGEX'): | |
for x in settings.RANDOM_IMAGE_REGEX: | |
p,g = x | |
if g and p in self.path: | |
return "%s%s/%s" % (settings.MEDIA_ROOT, self.path, g) | |
This file contains 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
Read the file a line at a time, and if we find a line that begins VEP | |
then we're in business. | |
1. Store VEPXXXXXX somewhere, until we get a whitespace. | |
2. Rest of line (strip off whitespace) is a name. | |
3. Keep reading lines until the end of a line contains 2 chars a space | |
and 9 digits (MO 631464129). Until that point, each row is part of | |
the address. | |
4. The next line will start with a product name, and the next line will |
This file contains 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
Failed: 500 code: {"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[noDF3TLpSC6uLoDruk2iwg][ckan-demo.ckan.org][4]: RemoteTransportException[[Bloodwraith][inet[/193.34.146.144:9300]][search/phase/query]]; nested: QueryPhaseExecutionException[[ckan-demo.ckan.org][4]: query[filtered(ConstantScore(ConstantScore(*:*)))->FilterCacheFilterWrapper(_type:281dffa6-ea9b-4446-be41-05dced06591f)],from[0],size[100],sort[<custom:\"Date\": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@777c1ce3>]: Query Failed [Failed to execute main query]]; nested: IOException[Can't sort on string types with more than one value per doc, or more than one token per field]; }{[noDF3TLpSC6uLoDruk2iwg][ckan-demo.ckan.org][3]: RemoteTransportException[[Bloodwraith][inet[/193.34.146.144:9300]][search/phase/query]]; nested: QueryPhaseExecutionException[[ckan-demo.ckan.org][3]: query[filtered(ConstantScore(ConstantScore(*:*)))->FilterCacheFilterWrapper(_type:281dffa6-ea9b-4446 |
This file contains 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
Failed: 500 code: | |
{"error":"SearchPhaseExecutionException | |
[Failed to execute phase [query], total failure; | |
shardFailures {[noDF3TLpSC6uLoDruk2iwg][ckan-demo.ckan.org][4]: | |
RemoteTransportException[[Bloodwraith][inet[/193.34.146.144:9300]][search/phase/query]]; nested: QueryPhaseExecutionException[[ckan-demo.ckan.org][4]: query[filtered(ConstantScore(ConstantScore(*:*)))->FilterCacheFilterWrapper(_type:281dffa6-ea9b-4446-be41-05dced06591f)],from[0],size[100],sort[<custom:\"Date\": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@777c1ce3>]: Query Failed [Failed to execute main query]]; nested: IOException[Can't sort on string types with more than one value per doc, or more than one token per field]; }{[noDF3TLpSC6uLoDruk2iwg][ckan-demo.ckan.org][3]: RemoteTransportException[[Bloodwraith][inet[/193.34.146.144:9300]][search/phase/query]]; nested: QueryPhaseExecutionException[[ckan-demo.ckan.org][3]: query[filtered(ConstantScore(ConstantScore(*:*)))->FilterCacheFilterWrapper(_type:281dffa6-ea9b |
This file contains 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
Traceback (most recent call last): | |
File "/Users/ross/Work/Servercode/okfn/pyenv/bin/nosetests", line 8, in <module> | |
load_entry_point('nose==1.1.2', 'console_scripts', 'nosetests')() | |
File "/Users/ross/Work/Servercode/okfn/pyenv/lib/python2.7/site-packages/nose/core.py", line 118, in __init__ | |
**extra_args) | |
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__ | |
self.parseArgs(argv) | |
File "/Users/ross/Work/Servercode/okfn/pyenv/lib/python2.7/site-packages/nose/core.py", line 135, in parseArgs | |
self.config.configure(argv, doc=self.usage()) | |
File "/Users/ross/Work/Servercode/okfn/pyenv/lib/python2.7/site-packages/nose/config.py", line 339, in configure |
This file contains 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
import csv | |
from datetime import datetime | |
from subprocess import Popen, PIPE | |
from models import (Consignee, ConsigneeItem) | |
TABLES = [ | |
("Consignee", Consignee,), | |
("Item", ConsigneeItem,), | |
] |
This file contains 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
curl -s "https://api.scraperwiki.com/api/1.0/datastore/sqlite?format=csv&name=tourist_arrival_statistics_sikkim&query=select+*+from+swdata&apikey=" | awk -F"," '{print $2, $3}' | tail -n+2 | curl -s --data-binary @- datafart.com |
This file contains 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
#!/usr/bin/env python | |
import csv | |
import sys | |
import urllib2 | |
import webbrowser | |
def send_to_datafart(url, cols, skip_headers): | |
handle = urllib2.urlopen(url) | |
reader = csv.reader(handle) | |
if skip_headers: |
This file contains 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
<?php | |
function get_details($key, $email) { | |
$csv = 'https://spreadsheets.google.com/pub?key=' . $key . '&output=csv&ndplr=1'; | |
$session = curl_init(); | |
curl_setopt( $session, CURLOPT_HEADER, 0 ); | |
curl_setopt( $session, CURLOPT_RETURNTRANSFER, TRUE ); | |
curl_setopt( $session, CURLOPT_URL, $csv ); |
OlderNewer