Diskuze: Request login
Zobrazeno 4 zpráv z 4.
//= Settings::TRACKING_CODE_B ?> //= Settings::TRACKING_CODE ?>
Chces najit chybu ve tvem kodu? Proc si ho nechavas tedy pro sebe?
google = python request
https://naucse.python.cz/…ro/requests/
google = python request read
google = python request read vars
http://zetcode.com/…honrequests/
import requests # importuje funkce requestu
response = requests.post() # odesli post request + params
# neco jako <form method=post><input type=hidden name=x
value=123><input type=submit></form> a kliknes na tlacitko
response = requests.get # odesli get request + params
# <form method=get> nebo <a href=...>
http://zetcode.com/…honrequests/
import requests as req
resp = req.get("http://localhost/greet.php?name=Peter")
print(resp.text)
Php kod a Py kod dela neco jineho, ikdyz tam pisou, ze to dela totez.
Spravny php kod by vypadal takto:
response = file_get_contents(url);
Jo díky, měl jsem to s tím PHPkem trochu pomotané. Ale proč to zadávám
do url:https://api.github.com/user a ne na běžné přihlášení:
https://github.com/login
Kde bych našel takovou verzi třeba pro seznam.cz
google = python request seznam cz login
https://napoveda.sklik.cz/…ak-examples/
def login(self):
response = post("https://api.sklik.cz/drak/json/client.login",json=("", ""))
res = response.json()
if res["status"] == 200:
self.session = res["session"]
return True
else:
return False
https://github.com/…ython-client
Tady to resi pres ServerProxy, __proxy.client.login.
https://github.com/seznam/fastrpc
fastrpc/python/example/client_example.py
take pres proxy (to proxy nejspis bude vhodnejsi pro chatovaci programy)
client = fastrpc.ServerProxy("http://localhost:2424/RPC2", readTimeout=1000,
writeTimeout=1000, connectTimeout=1000,
useBinary=fastrpc.ON_SUPPORT_ON_KEEP_ALIVE)
google = python request login
payload = {'inUserName': 'USERNAME/EMAIL', 'inUserPass': 'PASSWORD'}
url = 'http://www.locationary.com/home/index2.jsp'
requests.post(url, data=payload)
---
import requests
# Fill in your details here to be posted to the login form.
payload = {
'inUserName': 'username',
'inUserPass': 'password'
}
# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
p = s.post('LOGIN_URL', data=payload)
# print the html returned or something more intelligent to see if it's a successful login page.
print p.text
# An authorised request.
r = s.get('A protected web page url')
print r.text
# etc...
---
<form name="loginform" method="post" action="userinfo.php">
import requests
url = 'http://example.com/userinfo.php'
values = {'username': 'user',
'password': 'pass'}
r = requests.post(url, data=values)
print r.content
---
url = "https://www.voxbeam.com//login"
data = {'userName':'xxxxxxxxx','password':'yyyyyyyyy','challenge':'zzzzzzzzz','hash':''}
# note that in email have encoded '@' like uuuuuuu%40gmail.com
session = requests.Session()
r = session.post(url, headers=headers, data=data)
---
url = "https://www.voxbeam.com"
headers = {'user-agent': "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36"}
cookies = {'PHPSESSID':'zzzzzzzzzzzzzzz', 'loggedIn':'yes'}
s = requests.Session()
r = s.post(url, headers=headers, cookies=cookies)
Zobrazeno 4 zpráv z 4.