Skip to content

Commit

Permalink
Experimental Release
Browse files Browse the repository at this point in the history
  • Loading branch information
shivareddyiirs committed Oct 24, 2019
1 parent fc17136 commit f4d8940
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
30 changes: 20 additions & 10 deletions QRealTime_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def getTable(self,XFormKey,importData,topElement,version= 'null'):
try:
response = requests.request(method,url,proxies=getProxiesConf(),auth=self.getAuth(),verify=False)
except:
self.iface.messageBar().pushWarning(self.tr(self.tag),self.tr("Not able to connect to server"))
self.iface.messageBar().pushCritical(self.tr(self.tag),self.tr("Not able to connect to server"))
return response, table
if not response.status_code == 200:
return response, table
Expand Down Expand Up @@ -673,30 +673,40 @@ def sendForm(self,xForm_id,payload):
return response
def getFormList(self):
user=self.getValue('user')
url=self.getValue('url')+'/assets/'
turl=self.getValue('url')
if turl:
url=turl+'/assets/'
else:
self.iface.messageBar().pushWarning(self.tr(self.tag),self.tr("Enter url in settings"))
return {},None
# print (url)
status='not able to download'
para={'format':'json'}
response= requests.get(url,auth=(self.getValue('user'), self.getValue('password')),params=para)
forms= response.json()
keyDict={}
questions=[]

try:
response= requests.get(url,auth=(self.getValue('user'), self.getValue('password')),params=para)
forms= response.json()
for form in forms['results']:
if form['asset_type']=='survey' and form['deployment__active']==True:
keyDict[form['name']]=form['uid']
# print('keyDict is',keyDict)
return keyDict,response
except:
print ('getformList','not able to get the forms')
self.iface.messageBar().pushCritical(self.tr(self.tag),self.tr("Invalid url username or password"))
return {},response
def importData(self,layer,selectedForm,importData=True):
#from kobo branchQH
url=self.getValue('url')+'/assets/'+selectedForm
turl=self.getValue('url')
if turl:
url=turl+'/assets/'+selectedForm
else:
self.iface.messageBar().pushWarning(self.tr(self.tag),self.tr("Enter url in settings"))
para={'format':'xml'}
requests.packages.urllib3.disable_warnings()
response= requests.request('GET',url,proxies=getProxiesConf(),auth=(self.getValue('user'), self.getValue('password')),verify=False,params=para)
try:
response= requests.request('GET',url,proxies=getProxiesConf(),auth=(self.getValue('user'), self.getValue('password')),verify=False,params=para)
except:
self.iface.messageBar().pushCritical(self.tr(self.tag),self.tr("Invalid url,username or password"))
if response.status_code==200:
xml=response.content
# with open('importForm.xml','w') as importForm:
Expand All @@ -705,7 +715,7 @@ def importData(self,layer,selectedForm,importData=True):
layer.setName(self.layer_name)
self.collectData(layer,selectedForm,importData,self.layer_name,self.version,self.geoField)
else:
print("unable to connect to KOBO server")
self.iface.messageBar().pushWarning(self.tr(self.tag),self.tr("not able to connect to server"))
def updateLayerXML(self,layer,xml):
geoField=''
ns='{http://www.w3.org/2002/xforms}'
Expand Down
6 changes: 3 additions & 3 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
name=QRealTime
qgisMinimumVersion=3.00
description=This plugin connects you to ODK Server and do autoupdation of data to and from aggregate
version=3.8
version=3.9
author=Shiva Reddy Koti, Prabhakar Alok Verma
[email protected]

Expand All @@ -23,14 +23,14 @@ repository=https://github.com/shivareddyiirs/QRealTime/
# Recommended items:

# Uncomment the following line and add your changelog:
changelog= 3.8:Bug fixed causing no import when trying to import from password protected forms. Support for date-time field is also added. 3.6: this version has major bug fixings for sync functionality. User are highly recommended to update. 3.5.2: Improved geometry field detection: Now field is choosen based on its type rather than name. Url encoding to avoid 400 error 3.5.1: Removed unnecesary import pip.3.5: Now installing package 'pyxform' automatically. Tested in Mac and Windows. 3.4: Changes Major refactoring to replace 'print' statements with QgsMessageLog: It avoids QGIS crashes and make it thread safe.Now user can see all print statement outputs in log messages under 'QRealTime' tag. Some UI Improvements and minor bug fixes.
changelog= 3.9: only recommended for advanced user for testing purpose only,experimental support for koboToolbox server, currently tested with humanatarian instance hosted by UNOCHA,url validation 3.8:Bug fixed causing no import when trying to import from password protected forms. Support for date-time field is also added. 3.6: this version has major bug fixings for sync functionality. User are highly recommended to update. 3.5.2: Improved geometry field detection: Now field is choosen based on its type rather than name. Url encoding to avoid 400 error 3.5.1: Removed unnecesary import pip.3.5: Now installing package 'pyxform' automatically. Tested in Mac and Windows. 3.4: Changes Major refactoring to replace 'print' statements with QgsMessageLog: It avoids QGIS crashes and make it thread safe.Now user can see all print statement outputs in log messages under 'QRealTime' tag. Some UI Improvements and minor bug fixes.
# Tags are comma separated with spaces allowed
tags= ODK, Data Collection, Mobile GIS
homepage=https://shivareddyiirs.github.io/QRealTime/
category=Plugins
icon=icon.png
# experimental flag
experimental=False
experimental=True

# deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False
Expand Down

0 comments on commit f4d8940

Please sign in to comment.