diff --git a/importer/README.md b/importer/README.md index 72178fc..e9b9a83 100644 --- a/importer/README.md +++ b/importer/README.md @@ -18,7 +18,7 @@ This script is used to setup keycloak roles and groups. It takes in a csv file w ### To run script 1. Create virtualenv 2. Install requirements.txt - `pip install -r requirements.txt` -3. Set up your .env file, see sample below. Populate it with the right credentials, you can either provide an access token or client credentials. Ensure that the user whose details you provide in this config file has the necessary permissions/privileges. +3. Set up your _.env_ file, see sample below. Populate it with the right credentials, you can either provide an access token or client credentials. Ensure that the user whose details you provide in this _.env_ file has the necessary permissions/privileges. 4. Run script - `python3 main.py --setup roles --csv_file csv/setup/roles.csv --group Supervisor` 5. If you are running the script without `https` setup e.g locally or a server without https setup, you will need to set the `OAUTHLIB_INSECURE_TRANSPORT` environment variable to 1. For example `export OAUTHLIB_INSECURE_TRANSPORT=1 && python3 main.py --setup roles --csv_file csv/setup/roles.csv --group OpenSRP_Provider --log_level debug` 6. You can turn on logging by passing a `--log_level` to the command line as `info`, `debug` or `error`. For example `python3 main.py --setup roles --csv_file csv/setup/roles.csv --group Supervisor --log_level debug` @@ -51,7 +51,7 @@ and then posts them to the API for creation ### To run script 1. Create virtualenv 2. Install requirements.txt - `pip install -r requirements.txt` -3. Create a `config.py` file. The `sample_config.py` is an example of what this should look like. Populate it with the right credentials +3. Set up your _.env_ file, see sample above. Populate it with the right credentials, you can either provide an access token or client credentials. Ensure that the user whose details you provide in this _.env_ file has the necessary permissions/privileges. 4. Run script - `python3 main.py --csv_file csv/locations.csv --resource_type locations` 5. You can turn on logging by passing a `--log_level` to the command line as `info`, `debug` or `error`. For example `python3 main.py --csv_file csv/locations.csv --resource_type locations --log_level info` 6. There is a progress bar that shows the read_csv and build_payload progress as it is going on @@ -161,7 +161,7 @@ The coverage report `coverage.html` will be at the working directory - See example csv [here](/importer/csv/import/product.csv) - This creates a Group resource for each product imported, a Binary resource for any products with an image, and a List resource with references to all the Group and Binary resources created - The first two columns __name__ and __active__ is the minimum required -- The last column __imageSourceUrl__ contains a url to the product image. If this source requires authentication, then you need to provide the `product_access_token` in the config file. The image is added as a binary resource and referenced in the product's Group resource +- The last column __imageSourceUrl__ contains a url to the product image. If this source requires authentication, then you need to provide the `product_access_token` in the _.env_ file. The image is added as a binary resource and referenced in the product's Group resource - You can pass in a `list_resource_id` to be used as the identifier for the List resource, or you can leave it empty and a random uuid will be generated ### 11. Import inventories from openSRP 1 diff --git a/importer/importer/users.py b/importer/importer/users.py index e34d3c8..2585d2a 100644 --- a/importer/importer/users.py +++ b/importer/importer/users.py @@ -71,6 +71,7 @@ def create_user(user): return user_id else: + logging.info(r.text) return 0