Skip to content

Instantly share code, notes, and snippets.

@yifeikong yifeikong/client.py
Created Apr 3, 2018

Embed
What would you like to do?
#!/usr/bin/env python
# coding: utf-8
import requests
def main():
r = requests.post('http://localhost:8080/api', json={'foo': 'bar'})
print(r.text)
if __name__ == "__main__":
main()
#!/usr/bin/env python
# coding: utf-8
from bottle import post, request, run
@post('/api')
def api():
print(f"data received:\n {request.json}")
return "ok"
if __name__ == "__main__":
run(port=8080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.