1

I was able to create a script which imports into QGIS .vrt files from a private bucket in Amazon Web Services S3.

But I had this one-time task to manually set the environment custom variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

What I did was: Settings (1) -> Options (2) -> System (3) --> Environment (use custom variables) (4) --> Variable (5) --> Values (6)

Is there a way to do this with PyQGIS?

enter image description here

I am using QGIS 3.34.5

Taras
35.8k5 gold badges77 silver badges151 bronze badges
asked Apr 16, 2024 at 19:56
0

1 Answer 1

5

You could just use os.environ at the start of your script:

import os
os.environ["AWS_ACCESS_KEY_ID"] = "Some value"
os.environ["AWS_SECRET_ACCESS_KEY"] = "Another value"
answered Apr 17, 2024 at 3:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.