Last active
December 26, 2015 08:09
-
-
Save ayafujiaya/7120112 to your computer and use it in GitHub Desktop.
Codes which I store json data to fluentd-json-receiver ( https://github.com/HOUSE-API-Project/fluentd-json-receiver ) by POST method.
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
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import requests | |
import json | |
from requests.auth import HTTPBasicAuth | |
url = 'http://133.242.144.202/post' | |
payload = {'tag':'shibuhouse.testpost', 'data':'{"moge":"hoge"}'} | |
headers = {'content-type': 'application/json'} | |
auth = HTTPBasicAuth("user","password") | |
r = requests.post(url, data=json.dumps(payload), headers=headers, auth=auth) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment