Dear Pushsafer,
I'm pretty new in coding and on your platform.
I have created a web scraper in Python, which prints me a specific text that is taken out of the website. I would like to set a notification that says the scraped text in the message (the text is different each time I run the process).
I managed to set up message notifications using your example:
From pushsafer import init, Client
init("<privatekey>")
Client("").send_message("Message", "Hello", "323", "1", "4", "2", "https://www.pushsafer.com", "Open Pushsafer", "0", "2", "60", "600", "1", "", "", "")
Example of my scrape:
for Word6 in soup.findAll(attrs={'example' : 'heyhowyoudoin'}):
print(Word6.text.strip())
However I can't figure out how to set the printed scraped text in the message automatically each time.
Thank you very much for your support.
Felix
text in output as a message
- admin
- Site Admin
- Posts: 1006
- Joined: 1. Dec 2014, 12:41
- Location: Germany
Re: text in output as a message
that should do the job
Code: Select all
init("<privatekey>")
Client("").send_message(Word6.text.strip(), "Hello", "323", "1", "4", "2", "https://www.pushsafer.com", "Open Pushsafer", "0", "2", "60", "600", "1", "", "", "")
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Re: text in output as a message
Thank you very much sir!admin wrote: ↑16. Sep 2021, 07:22that should do the job
Code: Select all
init("<privatekey>") Client("").send_message(Word6.text.strip(), "Hello", "323", "1", "4", "2", "https://www.pushsafer.com", "Open Pushsafer", "0", "2", "60", "600", "1", "", "", "")
Should have thought of that before asking.
Now it sends me the notification, however the notification only includes the very last line scraped.
Lets say that Word6.text.strip() scrapes this from a website:
Apple is red
Orange is orange
Watermelon is green
The notification only includes 'Watermelon is green' even though it is all part of the Word6.text.strip() that is supposed to be notified.
Thank you very much for your time and sorry for beginner mistakes
Felix
- admin
- Site Admin
- Posts: 1006
- Joined: 1. Dec 2014, 12:41
- Location: Germany
Re: text in output as a message
Hi, iam not a python pro
but try to change
to
strip() trim the text!
but try to change
Code: Select all
Word6.text.strip()
Code: Select all
Word6.text
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Who is online
Users browsing this forum: No registered users and 62 guests