Skip to content

Commit

Permalink
Change config in api scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
blagojabozinovski committed Apr 15, 2024
1 parent ffa3c2f commit 7ca73f1
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
image: openknowledge/ckan-dev:2.9
services:
solr:
image: ckan/ckan-solr-dev:2.9
image: ckan/ckan-solr:2.9-solr8
postgres:
image: ckan/ckan-postgres-dev:2.9
env:
Expand Down
20 changes: 3 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,25 @@

# ckanext-bulkupload

**TODO:** Put a description of your extension here: What does it do? What features does it have? Consider including some screenshots or embedding a video!
CKAN extension for bulk upload of resources.
The extension is customazed for Xcaret Open data portal.


## Requirements

**TODO:** For example, you might want to mention here which versions of CKAN this
extension works with.

If your extension works across different versions you can add the following table:

Compatibility with core CKAN versions:

| CKAN version | Compatible? |
| --------------- | ------------- |
| 2.6 and earlier | not tested |
| 2.7 | not tested |
| 2.8 | not tested |
| 2.9 | not tested |
| 2.9 | Yes |

Suggested values:

* "yes"
* "not tested" - I can't think of a reason why it wouldn't work
* "not yet" - there is an intention to get it working
* "no"


## Installation

**TODO:** Add any additional install steps to the list below.
For example installing any non-Python dependencies or adding any required
config settings.

To install ckanext-bulkupload:

1. Activate your CKAN virtual environment, for example:
Expand Down
29 changes: 28 additions & 1 deletion ckanext/bulkupload/scripts/bulk_upload_xcaret.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,34 @@
import ssl
from os import walk
from datetime import datetime
from variables import *
import configparser


config = configparser.ConfigParser()
config.read("config.ini")
FOLDER_PATH = config.get("configvars", "FOLDER_PATH")
API_TOKEN = config.get("configvars", "API_TOKEN")
DATASET_NAME = config.get("configvars", "DATASET_NAME")
DESCRIPTION = config.get("configvars", "DESCRIPTION")
SUBJECT = config.get("configvars", "SUBJECT")
CREATOR = config.get("configvars", "CREATOR")
PUBLISHER = config.get("configvars", "PUBLISHER")
CONTRIBUTOR = config.get("configvars", "CONTRIBUTOR")
DATE = config.get("configvars", "DATE")
TYPE = config.get("configvars", "TYPE")
IDENTIFIER = config.get("configvars", "IDENTIFIER")
SOURCE = config.get("configvars", "SOURCE")
LANGUAGE = config.get("configvars", "LANGUAGE")
RELATION = config.get("configvars", "RELATION")
COVERAGE = config.get("configvars", "COVERAGE")
RIGHTS = config.get("configvars", "RIGHTS")
MEDIUM = config.get("configvars", "MEDIUM")
SOURCE_OF_ACQUISITION = config.get("configvars", "SOURCE_OF_ACQUISITION")
ORGANIZATIONAL_DESCRIPTION = config.get("configvars", "ORGANIZATIONAL_DESCRIPTION")
PHYSICAL_TECHNICAL = config.get("configvars", "PHYSICAL_TECHNICAL")
LOCATION = config.get("configvars", "LOCATION")
RULES = config.get("configvars", "RULES")


now = datetime.now()
now_date = str(now.date())
Expand Down
24 changes: 24 additions & 0 deletions ckanext/bulkupload/scripts/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[configvars]
FOLDER_PATH :'/path/to/upoad/files'
API_TOKEN : 'abc123454321cba'
DATASET_NAME : 'Dataset-name'
DESCRIPTION : 'Some description'
SUBJECT : 'Test Subject'
CREATOR : 'Joe Blogs'
PUBLISHER : 'Joe Publisher'
CONTRIBUTOR : 'Joe Contributor'
DATE : '01/01/2024' # Date format MM/DD/YYYY
TYPE : 'Resource'
IDENTIFIER : 'Value Identifier'
SOURCE : 'http://www.bing.com'
LANGUAGE : 'English'
RELATION : 'Value Relation'
COVERAGE : 'International'
RIGHTS : 'Value rights'
MEDIUM : 'Value Medium'
SOURCE_OF_ACQUISITION : 'Value Source of Aquisition'
ORGANIZATIONAL_DESCRIPTION : 'alphabetically'
PHYSICAL_TECHNICAL : 'Value Relevant physical conditions'
LOCATION : 'Value Location'
RULES : 'Value Rules'

23 changes: 0 additions & 23 deletions ckanext/bulkupload/scripts/variables.py

This file was deleted.

0 comments on commit 7ca73f1

Please sign in to comment.