Comments (8)
You should encode image via base64
with open("path/to/image.jpg", "rb") as img_file:
encoded = base64.b64encode(img_file.read()).decode('ascii')
Session1.activityImage("data:image/jpeg;base64, "+str(encoded))
from pymsteams.
Thanks @apolivin, this works for me. However, I get a 400 error when the image is too large. This might be related to #34
from pymsteams.
The image within this activity is tiny. Is there a way to post a properly-sized image?
from pymsteams.
OK, maybe you could update the docs that you can easily use HTML for larger images? 🙈 Thx for the great package!
from pymsteams.
You can include an image as HTML, in a text block, as follows:
myTeamsMessage.text("<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />")
from pymsteams.
@LeonardoSanBenitez I know how to do it now but it's not mentioned in the docs 😃
from pymsteams.
I want to attach about 119Kb png file.
But, when i sent image, teams show below msg.
This message is too long to display here. Please visit the external source app to view the message.
How can i attach image?
from pymsteams.
I want to attach about 119Kb png file. But, when i sent image, teams show below msg.
This message is too long to display here. Please visit the external source app to view the message.
How can i attach image?
It's a limitation of the api. The error message is suggesting you make the image available via external service, then link to it.
from pymsteams.
Related Issues (20)
- HttpPost Basic Auth. HOT 6
- Non-http link buttons don't show HOT 2
- [Question] Delete message generator by Incoming Webhook HOT 1
- pymsteams async_connectorcard Python 2 incompatibility HOT 4
- Add tags to connectorcard HOT 7
- Help needed HOT 1
- 0.2.1 issue with last_http_status HOT 2
- Adding Text to Card does not work if PotentialAction or CardSection is added prior
- How to add mension in text HOT 2
- Pinning requirements HOT 3
- TeamsWebhookException despite successful POST HOT 6
- Adaptive card is not rendered on android phone HOT 1
- HTML tables stopped working HOT 4
- "==" not sent properly HOT 1
- proxy params is changed for httpx HOT 1
- Handling MS Teams Rate Limit Request Failures HOT 1
- !important (Notification)
- Ongoing Support and Request for Maintainers HOT 7
- .color() not working HOT 2
- SetuptoolsDeprecationWarning: use of dashes
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 pymsteams.