Last active
November 13, 2020 00:06
-
-
Save parthaa/5a474d1838ab16aa2fb14560f04b7619 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
import json | |
import requests | |
import sys | |
from requests.auth import HTTPBasicAuth | |
from pprint import pprint | |
def fetch_metadata(fl): | |
with open(fl, "r") as content: | |
data = json.load(content) | |
return data | |
def do_export(cvv_id, from_history_id = None): | |
url = "http://localhost:3000/katello/api/content_exports/export" | |
post_json = {'destination_server':"downstream.example.com", 'content_view_version_id': cvv_id} | |
if from_history_id: | |
post_json['from_history_id'] = from_history_id | |
return requests.post(url, auth=HTTPBasicAuth('admin', 'changeme'), json = post_json) | |
if len(sys.argv) == 1: | |
print("usage: ", sys.argv[0], '<Content View Version Id> <from_history_id>') | |
sys.exit(-1) | |
pprint(do_export(*sys.argv[1:]).json()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment