Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index International Gentoo Users Greek
  • Search

Script gia apostolh sms mesw cool4u.otenet.gr ?

Καλώs ήρθατε στο ελληνικό φόρουμ του Gentoo!
Post Reply
  • Print view
Advanced search
5 posts • Page 1 of 1
Author
Message
zen_guerrilla
Guru
Guru
User avatar
Posts: 343
Joined: Thu Apr 18, 2002 9:49 am
Location: Greece

Script gia apostolh sms mesw cool4u.otenet.gr ?

  • Quote

Post by zen_guerrilla » Wed Apr 19, 2006 4:00 pm

Hello,
3ereis kaneis an yparxei kanena scriptaki gia na stelneis sms mesw cool4u.otenet.gr ?
Exw syndesh otenet k 9a me voleve poly na xrhsimopoiousa kati tetoio stous server mou.

TIA
Top
atma
n00b
n00b
Posts: 13
Joined: Fri Sep 22, 2006 5:32 pm
Location: Greece, Drama
Contact:
Contact atma
Website

pezei

  • Quote

Post by atma » Fri Oct 27, 2006 8:20 am

Ma yparxoun eidikes thires (gateway) gia na pejei kapio programa? Giati programmata gia na stileis sms yparxoun apo pallia alla prepei na exeis (sinithos sindromi) se kapio gateway.
Ektos apo to web-inteface loipon prosferei kai gateway gia sms to cool4you?
I like Apples!
Top
atma
n00b
n00b
Posts: 13
Joined: Fri Sep 22, 2006 5:32 pm
Location: Greece, Drama
Contact:
Contact atma
Website

Script for cool4u

  • Quote

Post by atma » Sun Mar 11, 2007 1:19 am

πρώτα κάνε ένα "emerge mechanize" και μετά με αυτό το script είσαι έτοιμμος..

Code: Select all

OSX atma ~/Documents $ cat cool4u.py 
#!/usr/bin/env python
#
# cool4u v0.1
# Dependencies : mechanize
# Simple script to send sms via cool4u web2sms service from otenet
#
# Author: Gregory Potamianos <gregpuppy@gmail.com>
# Published under the GPL v2 :P
#

from mechanize import Browser
import sys,signal

otenet = Browser()

def login(user,password):
        otenet.open("http://tools.otenet.gr/tools/index.do")
        otenet.select_form(name="loginform")
        otenet["username"] = user
        otenet["password"] = password
        print "\nLogging in..."
        otenet.submit()

def sendsms(number,message):
        otenet.open("http://tools.otenet.gr/tools/tiles/web2sms.do?showPage=smsSend&mnu=smenu23")
        try:
                otenet.select_form(name="sendform")
        except:
                print "An Error occured. Probably Wrong Username/Password"
                sys.exit(1)

        otenet["phone"] = number
        otenet["message"] = message
        exceeded = len( otenet["message"] ) - (155 - len( otenet["email"] ))
        print "Submiting Request..."
        if exceeded > 0 :
                print "\nYou exceeded the available characters by %d\n" % (exceeded)
                sys.exit(exceeded)
        otenet.submit()
        print "Message Sent"


if __name__ == '__main__' :

        def handler(*args):
                print "\n\nBye Bye!"
                sys.exit(0)


        signal.signal(signal.SIGINT,handler)

        if len(sys.argv) == 1 :
                user = raw_input("Username : ")
                passwd = raw_input("Password : ")
                login(user,passwd)

                number = raw_input("Phone Number : ")
                msg = raw_input("SMS Message : ")
                sendsms(number,msg)
        else :
                if len(sys.argv) != 5 :
                        print "\nWrong Number of Parameters."
                        print "Usage %s <username> <password> <number> <sms>" % (sys.argv[0])
                        print "or user the interactive interface."
                else :
                        login(sys.argv[1],sys.argv[2])
                        sendsms(sys.argv[3],sys.argv[4])

OSX atma ~/Documents $ 
I like Apples!
Top
zen_guerrilla
Guru
Guru
User avatar
Posts: 343
Joined: Thu Apr 18, 2002 9:49 am
Location: Greece

  • Quote

Post by zen_guerrilla » Sun Mar 11, 2007 2:22 pm

atma: το script δουλεύει. Thanks ! :mrgreen:
Top
manos
n00b
n00b
Posts: 12
Joined: Sun Apr 10, 2005 3:20 pm
Location: Greece

Script for cool4u (πρόβλημα και λύση)

  • Quote

Post by manos » Tue Mar 13, 2007 2:51 am

Δυστυχώς δεν υπάρχει πακέτο mechanize στο portage.
(Υπάρχουν τα πακέτα Test-WWW-Mechanize WWW-Mechanize-FormFiller και WWW-Mechanize στην κατηγορία dev-perl.)
Χρειαζόμαστε όμως το module mechanize για python που εγώ προσωπικά δεν είχα και έπαιρνα το μήνυμα:

Code: Select all

$ python2.4 cool4u.py
Traceback (most recent call last):
  File "cool4u.py", line 11, in ?
    from mechanize import Browser
ImportError: No module named mechanize
Για να το λύσω αυτό έκανα τα παρακάτω:
Κατέβασα το "Easy Install" http://peak.telecommunity.com/DevCenter ... sy-install και το έτρεξα ως root:

Code: Select all

#wget http://peak.telecommunity.com/dist/ez_setup.py
#python2.4 ez_setup.py
Αφού έγινε η εγκατάσταση, για να εγκαταστήσω το ζητούμενο module έτρεξα:

Code: Select all

 #easy_install mechanize
όπως γράφει στη σελίδα http://wwwsearch.sourceforge.net/mechanize/, στην παράγραφο Getting mechanize - EasyInstall / setuptools

Μετά από αυτά, το script έτρεξε κανονικά..
Ευχαριστώ atma :D

Ίσως το μόνο που μένει είναι να μην αφήνει τον χρήστη να γράψει πάνω από τους επιτρεπτούς χαρακτήρες αντί να δίνει:

Code: Select all

You exceeded the available characters by ...
Top
Post Reply
  • Print view

5 posts • Page 1 of 1

Return to “Greek”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy