示例#1
0
文件: app.py 项目: Gcav66/aWhere-App
def fields():
    fields = None
    template = 'fields.html'
    fields_out = 'fields_out.html'
    if request.method == 'POST':
        if request.form['submit'] == 'Observations':
            key = request.form['key']
            secret = request.form['secret']
            y = AWhereCall(key, secret)
            fields = y.get_fields()
            return render_template(fields_out, fields=fields)
        elif request.form['submit'] == 'Fields':
            key = request.form['key']
            secret = request.form['secret']
            y = AWhereCall(key, secret)
    return render_template(template)
示例#2
0
文件: app.py 项目: Gcav66/aWhere-App
def fields():
    fields = None
    template = 'fields.html'
    fields_out = 'fields_out.html'
    if request.method == 'POST':
        if request.form['submit'] == 'Observations':
            key = request.form['key']
            secret = request.form['secret']
            y = AWhereCall(key, secret)
            fields = y.get_fields()
            return render_template(fields_out, fields=fields)
        elif request.form['submit'] == 'Fields':
            key = request.form['key']
            secret = request.form['secret']
            y = AWhereCall(key, secret)
    return render_template(template)
示例#3
0
文件: app.py 项目: Gcav66/aWhere-App
def signup():
    observations = 'observations.html'
    blat=18.30
    blong=-69.59
    if request.method == 'POST':
        print request.form
        #if request.form['Fields'] == 'Fields':
        if 'Create_Fields' in request.form:
            key = request.form['bkey']
            secret = request.form['bsecret']
            lat = request.form['blat']
            long = request.form['blong']
            field_id = request.form['field_id']
            farm_id = request.form['farm_id']
            y = AWhereCall(key, secret)
            fields = y.create_field(lat, long, field_id, farm_id)
            return render_template(observations, fields=fields)
        if 'BFields' in request.form:
            key = request.form['bkey']
            secret = request.form['bsecret']
            y = AWhereCall(key, secret)
            fields = y.get_fields()
            return render_template(observations, fields=fields)
        if 'Fields' in request.form:
            key = request.form['key']
            secret = request.form['secret']
            y = AWhereCall(key, secret)
            fields = y.get_fields()
            return render_template(observations, fields=fields)
        if 'Observations' in request.form:            
            key = request.form['bkey']
            secret = request.form['bsecret']
            field = request.form['field_id']
            y = AWhereCall(key, secret)
            out = y.get_observations(field)
            blat = out['observations'][0]['location']['latitude']
            blong = out['observations'][0]['location']['longitude']
            blong = -blong
            flat = y.flatten_observations(out)
            df = pd.DataFrame(flat)
            return render_template(observations, flat=df.to_html(), blat=blat, blong=blong)
        if 'Download' in request.form:
            key = request.form['bkey']
            secret = request.form['bsecret']
            field = request.form['field_id']
            y = AWhereCall(key, secret)
            out = y.get_observations(field)
            flat = y.flatten_observations(out)
            return excel.make_response_from_records(flat, "csv")
    return render_template(observations, blat=blat, blong=blong)
示例#4
0
from AWhereCall import AWhereCall

key = 'lpGunnkiij1439P1f3xFNer9GA3aL1eI'
secret = '61WbUcQiStz5mSMv'
field = 'gus_dc'

y = AWhereCall(key, secret)

#fields = y.get_fields()
#print fields

#resp = y.create_field(38.9, 77, 'gus_dc', 'dc')

#print resp


out = y.get_observations(field)

print out
print out['observations'][0]['location']['latitude']

'''
flat = y.flatten_observations(out)

print flat
'''
示例#5
0
文件: app.py 项目: Gcav66/aWhere-App
def signup():
    observations = 'observations.html'
    blat = 18.30
    blong = -69.59
    if request.method == 'POST':
        print request.form
        #if request.form['Fields'] == 'Fields':
        if 'Create_Fields' in request.form:
            key = request.form['bkey']
            secret = request.form['bsecret']
            lat = request.form['blat']
            long = request.form['blong']
            field_id = request.form['field_id']
            farm_id = request.form['farm_id']
            y = AWhereCall(key, secret)
            fields = y.create_field(lat, long, field_id, farm_id)
            return render_template(observations, fields=fields)
        if 'BFields' in request.form:
            key = request.form['bkey']
            secret = request.form['bsecret']
            y = AWhereCall(key, secret)
            fields = y.get_fields()
            return render_template(observations, fields=fields)
        if 'Fields' in request.form:
            key = request.form['key']
            secret = request.form['secret']
            y = AWhereCall(key, secret)
            fields = y.get_fields()
            return render_template(observations, fields=fields)
        if 'Observations' in request.form:
            key = request.form['bkey']
            secret = request.form['bsecret']
            field = request.form['field_id']
            y = AWhereCall(key, secret)
            out = y.get_observations(field)
            blat = out['observations'][0]['location']['latitude']
            blong = out['observations'][0]['location']['longitude']
            blong = -blong
            flat = y.flatten_observations(out)
            df = pd.DataFrame(flat)
            return render_template(observations,
                                   flat=df.to_html(),
                                   blat=blat,
                                   blong=blong)
        if 'Download' in request.form:
            key = request.form['bkey']
            secret = request.form['bsecret']
            field = request.form['field_id']
            y = AWhereCall(key, secret)
            out = y.get_observations(field)
            flat = y.flatten_observations(out)
            return excel.make_response_from_records(flat, "csv")
    return render_template(observations, blat=blat, blong=blong)