Skip to content

Instantly share code, notes, and snippets.

@parthaa
Last active November 13, 2020 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parthaa/5a474d1838ab16aa2fb14560f04b7619 to your computer and use it in GitHub Desktop.
Save parthaa/5a474d1838ab16aa2fb14560f04b7619 to your computer and use it in GitHub Desktop.
#!/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