Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-analytics-pipeline
Commits
490ea5c3
Commit
490ea5c3
authored
Jul 24, 2017
by
Andrew Zafft
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enables contacting partner specific URLs for course information.
parent
0adb9fb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
edx/analytics/tasks/warehouse/load_internal_reporting_course_catalog.py
+23
-3
No files found.
edx/analytics/tasks/warehouse/load_internal_reporting_course_catalog.py
View file @
490ea5c3
...
...
@@ -38,6 +38,13 @@ class LoadInternalReportingCourseCatalogMixin(WarehouseMixin, OverwriteOutputMix
default
=
None
,
description
=
"A list of partner short codes that we should fetch data for."
)
partner_api_urls
=
luigi
.
Parameter
(
default_from_config
=
{
'section'
:
'course-catalog-api'
,
'name'
:
'partner_api_urls'
},
is_list
=
True
,
default
=
None
,
description
=
"A list of API URLs that are associated with the partner_short_codes. This list must exactly "
+
"match the ordering of the partner_short_codes list."
)
api_root_url
=
luigi
.
Parameter
(
config_path
=
{
'section'
:
'course-catalog-api'
,
'name'
:
'api_root_url'
},
default
=
None
,
...
...
@@ -66,9 +73,22 @@ class PullCourseCatalogAPIData(LoadInternalReportingCourseCatalogMixin, luigi.Ta
'partner'
:
partner_short_code
,
'exclude_utm'
:
1
,
}
if
not
self
.
api_root_url
:
raise
luigi
.
parameter
.
MissingParameterException
(
"Missing api_root_url."
)
url
=
url_path_join
(
self
.
api_root_url
,
'course_runs'
)
+
'/'
if
self
.
partner_api_urls
:
url_index
=
short_codes
.
index
(
partner_short_code
)
if
url_index
>=
self
.
partner_api_urls
.
__len__
():
raise
luigi
.
parameter
.
MissingParameterException
(
"Error! Index of the partner short code from partner_short_codes exceeds the length of "
"partner_api_urls. These lists are not in sync!!!"
)
api_root_url
=
self
.
partner_api_urls
[
url_index
]
elif
self
.
api_root_url
:
api_root_url
=
self
.
api_root_url
else
:
raise
luigi
.
parameter
.
MissingParameterException
(
"Missing either a partner_api_urls or an "
+
"api_root_url."
)
url
=
url_path_join
(
api_root_url
,
'course_runs'
)
+
'/'
for
response
in
client
.
paginated_get
(
url
,
params
=
params
):
parsed_response
=
response
.
json
()
counter
=
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment