Forum Archive

Is it possible to interact with websites?

nealtz

Hello,

I'm new to Pythonista and Phython. I'm looking for a way to automate a process I have to do when I want to forward calls from my conventional telephone network to another number when I'm away from my office. I have to login on the website of my service provider and have to click several times and then put the number I want the calls forwarded to in a web form and send this to my provider.

I'm looking for a way to automate these Steps on an iPhone or iPad. After some searching I found Pythonista and I'm wondering if it is possible to do this with Pythonista or if anybody knows another way to do this?

ccc

This should be doable. I would recommend starting with requests.post()... See: http://omz-software.com/pythonista/docs/ios/requests.html

nealtz

Thank you for your answer!

Now I have a good reason to start learning Python ... ;-) !

Update 22.03.14: I reached my goal with this script 'Script to interact with TNG.de website to redirect telefon calls'.

Gerzer

I have the same question. I want to upload a picture to a website I made using the standard HTML file upload system. Here is the HTML:






    <html>  
    <body>  
    <form method="POST">  
    <input name="upload" type="file">  
    </form>  
    </body>  
    </html>  

Is there an easy way of doing this, maybe with Requests? I don't know what to do after this code:

import requests  
req = requests.post("my website url")

Any more information relating to this question or even @nealtz's question would help a lot.
Thanks!

-Coder123

ccc

@Coder123, Try out the first four lines of code at http://www.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file and tell us what happens.