move api process

parent a9333f8a
import imp
class APISentinel():
def getProducts(this):
GeoSentinel_path = "/home/emmanuelhp/Documentos/GeoSentinel/geosentinel/APISentinel.py"
api = imp.load_source('geosentinel', GeoSentinel_path)
sentinel = api.APISentinel('emmhp', 'geoemm29')
area = "POLYGON((-89.62543487548828 21.068482340502072,-89.51351165771484 20.918472761430806,-89.72705841064453 20.9203969139719,-89.62543487548828 21.068482340502072))"
products = sentinel.getProducts(area, ('20180101', '20180517'), {"platformname":"Sentinel-2", "cloudcoverpercentage":"[0 TO 10]"})
for p in products:
print products[p]["size"]
...@@ -10,7 +10,7 @@ from django.views.generic.base import View ...@@ -10,7 +10,7 @@ from django.views.generic.base import View
from django.template import loader from django.template import loader
from urllib import urlencode from urllib import urlencode
import requests, json, unicodedata import requests, json, unicodedata
import imp from apis.sentinel import APISentinel
# Create your views here. # Create your views here.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
...@@ -37,14 +37,8 @@ def productList(request): ...@@ -37,14 +37,8 @@ def productList(request):
""" """
View function for home page of site. View function for home page of site.
""" """
GeoSentinel_path = "/home/emmanuelhp/Documentos/GeoSentinel/geosentinel/APISentinel.py" s = APISentinel()
api = imp.load_source('geosentinel', GeoSentinel_path) s.getProducts()
sentinel = api.APISentinel('emmhp', 'geoemm29')
area = "POLYGON((-89.62543487548828 21.068482340502072,-89.51351165771484 20.918472761430806,-89.72705841064453 20.9203969139719,-89.62543487548828 21.068482340502072))"
products = sentinel.getProducts(area, ('20180101', '20180517'), {"platformname":"Sentinel-2", "cloudcoverpercentage":"[0 TO 10]"})
for p in products:
print products[p]["size"]
r2 = dict(request.POST) r2 = dict(request.POST)
r2.pop('csrfmiddlewaretoken', None) r2.pop('csrfmiddlewaretoken', None)
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment