通过 SL4A python 脚本将数据传递到网站

发布于 2025-01-05 20:03:46 字数 179 浏览 1 评论 0原文

请帮忙! 我需要使用 s4la python 将一些文本数据发布到电子邮件地址或网站表单,我该怎么做(不打开电子邮件客户端)?

需要明确的是:这将是一个“网上商店工具”,可以从二维码中读取信息并将其发送到网上商店。只需读取代码并读取“订购金额”并发送即可。

为什么是Python?因为那是我唯一可以使用的。 :)

Help please!
I need to post some text data to an e-mail adress or web site form using s4la python how can i do that(without opening e-mail client)?

Just to be clear: This will be a "webshop tool" that reads info from a qr code and sent it to the webshop. Just read a code and read an "ordered amount" and send them.

why python? Becouse thats the only one i can use. :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一人独醉 2025-01-12 20:03:46

要将数据发送到网站,请查看文件weather.py
当您安装 python 时,将提供此文件作为示例。

http://code.google.com /p/android-scripting/source/browse/python/ase/scripts/weather.py

它使用模块 urllib2

文件的有趣部分:

WEATHER_URL = 'http://www.google.com/ig/api?weather=%s&hl=%s'
url = WEATHER_URL % (urllib.quote(location), hl)
handler = urllib2.urlopen(url)
data = handler.read()

To send your data to a website, look at the file weather.py
This file is provided as example when you install python.

http://code.google.com/p/android-scripting/source/browse/python/ase/scripts/weather.py

it uses the module urllib2

interesting part of the file:

WEATHER_URL = 'http://www.google.com/ig/api?weather=%s&hl=%s'
url = WEATHER_URL % (urllib.quote(location), hl)
handler = urllib2.urlopen(url)
data = handler.read()
不知在何时 2025-01-12 20:03:46

如果您想连接到 Google 等 SMTP 服务器,可以使用 smtplib。

发送使用:

msg = MIMEMultipart()
msg['Subject'] = 'Our Subject'
msg['To'] = '[email protected]'
msg['From'] = '[email protected]'
msg.attach(MIMEText(body, 'plain'))

smtpObj = smtplib.SMTP(smtp_server,smtp_port)
smtpObj.starttls()
smtpObj.ehlo()
smtpObj.login(username,password)

smtpObj.sendmail(username,to_addr,msg.as_string())
smtpObj.close()

You can use smtplib if you want to connect to an SMTP server like Google.

To send use:

msg = MIMEMultipart()
msg['Subject'] = 'Our Subject'
msg['To'] = '[email protected]'
msg['From'] = '[email protected]'
msg.attach(MIMEText(body, 'plain'))

smtpObj = smtplib.SMTP(smtp_server,smtp_port)
smtpObj.starttls()
smtpObj.ehlo()
smtpObj.login(username,password)

smtpObj.sendmail(username,to_addr,msg.as_string())
smtpObj.close()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文