I am trying to deploy multiple ArcGIS Feature Service connections to all of the QGIS 3 users in my workplace.

Is there a way to do it using the Python API?

At the moment I'm manually adding the connections into the QGIS3.ini, like this :


but I would prefer to add them using Python if possible.

  • You can find the answer here. There is lot of expalanations available for adding WFS layer in QGIS. This might help you. Sep 21, 2018 at 6:28

1 Answer 1


See qgis.core.QgsSettings

Instantiate QgsSettings() in the QGIS console and you can access all the settings as keys/values

For ArcGIS FeatureServer, try:

[i for i in QSettings().allKeys() if 'arcgisfeatureserver' in i]

which will show all the keys for the featureserver settings.

For each feature service [SERVICENAME] and parameter [PARAM] the key [KEY] will be in the form:


Which you can set using QgsSettings().setValue([KEY], [VALUE])

So for your feature service you would have

QgsSettings().setValue('qgis/connections-arcgisfeatureserver/[SERVICENAME]/url', [URL])
QgsSettings().setValue('qgis/connections-arcgisfeatureserver/[SERVICENAME]/username', [USERNAME])
QgsSettings().setValue('qgis/connections-arcgisfeatureserver/[SERVICENAME]/password', [PASSWORD])
QgsSettings().setValue('qgis/connections-arcgisfeatureserver/[SERVICENAME]/authcfg', '')

Then update the GUI with


I think PyQt's QSettings() does the same thing too.

  • This solution has worked for me. It should be marked as the correct solution. Sep 23, 2020 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.