Comments (8)
Try this one:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import requests
url = 'http://localhost:7272/api/v0.1/{}/push'.format(os.environ('TIPBOARD_API_KEY'))
data_push = dict(
tile='text', key='id_1', data=json.dumps({"text":"Hello World"})
)
r = requests.post(url, data=data_push)
print(r.status_code, r.reason)
Of course, you have to define TIPBOARD_API_KEY
as system environment.
from tipboard.
What do you mean with
define
TIPBOARD_API_KEY
as system environment.
as: os.environ["TIPBOARD_API_KEY"] = "a8e0e4e8f58f4c0aa4f3e9ef2afc73b2"
?
Trying the code I now get an attribute errror: AttributeError: _Environ instance has no __call__ method
pointing at the url = ...
line.
Thanks for your help!
from tipboard.
Try this version
url = 'http://my_ip:7272/api/v0.1/a8e0e4e8f58f4c0aa4f3e9ef2afc73b2/push'
data_push = dict(
tile='text', key='id_1', data=json.dumps({"text":"Hello World"})
)
r = requests.post(url, data=data_push)
print(r.status_code, r.reason)
It's closer to your way.
from tipboard.
Still (403, 'Forbidden')
from tipboard.
try following command curl -X POST http://127.0.0.1:7272/api/v0.1/a8e0e4e8f58f4c0aa4f3e9ef2afc73b2/push -d 'tile=text&key=id_1&data={"text": "Hello world"}'
from command line
from tipboard.
From the command line I get:
(env) CMac:App cosbgn$ curl -X POST http://192.xxx.x.xx:7272/api/v0.1/a8e0e4e8f58f4c0aa4f3e9ef2afc73b2/push -d 'tile=text&key=id_1&data={"text": "Hello world"}'
Tile's name not found in the configuration file.
and
(env) CMac:App cosbgn$ curl -X POST http://127.0.0.1:7272/api/v0.1/a8e0e4e8f58f4c0aa4f3e9ef2afc73b2/push -d 'tile=text&key=id_1&data={"text": "Hello world"}'
curl: (7) Failed to connect to 127.0.0.1 port 7272: Connection refused
from tipboard.
Tile's name not found in the configuration file.
Make sure that you have something like this:
..
- tile_template: text
tile_id: id_1
..
in ~/.tipboard/layout_config.yaml
from tipboard.
Okey, so I had:
tile_template: empty
tile_id: empty
I've changed it to:
tile_template: text
tile_id: id_1
Now everything is solved! Thanks a lot!
from tipboard.
Related Issues (20)
- Dependency issue when installing tipboard through pip HOT 2
- Logic api push HOT 1
- Cols before Rows HOT 8
- advanced_plot examples give Error: No data specified HOT 1
- Question : Any resources on how to setup tipboard with nginx? HOT 6
- Internet Explorer 11 error "Unable to get property 'Windows' of undefined or null reference"
- pypi package out of date - new release possible HOT 2
- Issue when creating more than 3 rows HOT 1
- Setup timeout to redis connexion HOT 2
- Error when trying to update a simple tile HOT 1
- How to display photo in the title? HOT 1
- basic setup - Super n00b - help needed HOT 1
- update simple_percentage configuration does not take effect HOT 2
- NameError: name 'execfile' is not defined HOT 3
- Need Some Basic Help Getting Started HOT 5
- Is there a live demo anywhere?
- Light theme? HOT 1
- Can I install on Centos? HOT 1
- Send REST using windows powershell
- Installation failure - NameError: name 'execfile' is not defined
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tipboard.