Skip to content
Snippets Groups Projects
post_cli_tool.py 457 B
Newer Older
  • Learn to ignore specific revisions
  • fcrisafulli-dev's avatar
    fcrisafulli-dev committed
    import requests
    
    fcrisafulli-dev's avatar
    fcrisafulli-dev committed
    import sys
    
    fcrisafulli-dev's avatar
    fcrisafulli-dev committed
    
    # Specify the API URL we want to send our JSON to
    
    url = 'http://127.0.0.1:5000/database_service'
    
    fcrisafulli-dev's avatar
    fcrisafulli-dev committed
    # Specify the appropriate header for the POST request
    headers = {'Content-type': 'application/json'}
    # Specify the JSON data we want to send
    
    fcrisafulli-dev's avatar
    fcrisafulli-dev committed
    data = '{"command": "get_collection", "data": {"collection_name":"SENT FROM POST title"}}'
    
    response = requests.post(url, headers=headers, data=data)
    print(response.text,response.status_code)