Výukový program Python

Python HOME Úvod do Pythonu Začínáme s Pythonem Syntaxe Pythonu Komentáře Pythonu Proměnné Pythonu Datové typy Pythonu Python čísla Python Casting Python řetězce Python Booleans Operátoři Pythonu Seznamy Pythonu Python n-tice Sady Pythonu Slovníky Pythonu Python If...Else Python While Loops Python pro smyčky Funkce Pythonu Python Lambda Pole Python Třídy/objekty Pythonu Dědičnost Pythonu Iterátory Pythonu Rozsah Pythonu Moduly Pythonu Data v Pythonu Matematika Pythonu Python JSON Python RegEx Python PIP Zkuste Python... Kromě Vstup uživatele Pythonu Formátování řetězců v Pythonu

Manipulace se soubory

Práce se soubory Python Soubory pro čtení Pythonu Python Zápis/Vytváření souborů Python mazat soubory

Moduly Pythonu

Výukový program NumPy Návod Panda Výukový program Scipy

Python Matplotlib

Úvod do Matplotlib Matplotlib Začínáme Matplotlib Pyplot Vykreslování Matplotlib Markery Matplotlib Linka Matplotlib Štítky Matplotlib Matplotlib Grid Matplotlib Subplots Matplotlib Scatter Bary Matplotlib Histogramy Matplotlib Koláčové grafy Matplotlib

Strojové učení

Začínáme Střední střední režim Standardní odchylka Percentil Distribuce dat Normální distribuce dat Bodový diagram Lineární regrese Polynomiální regrese Vícenásobná regrese Měřítko Vlak/test Rozhodovací strom

Python MySQL

MySQL Začínáme Vytvořit databázi MySQL Vytvořit tabulku MySQL Vložit MySQL Vyberte MySQL Kde MySQL Pořadí MySQL podle Smazat MySQL MySQL Drop Table Aktualizace MySQL Limit MySQL Připojte se k MySQL

Python MongoDB

MongoDB Začněte Vytvořit databázi MongoDB Vytvořit sbírku MongoDB Vložení MongoDB Najít MongoDB Dotaz MongoDB Řazení MongoDB Smazat MongoDB MongoDB Drop Collection Aktualizace MongoDB Limit MongoDB

Reference Pythonu

Přehled Pythonu Vestavěné funkce Pythonu Metody pythonských řetězců Metody seznamu v Pythonu Metody slovníku Python Metody Python Tuple Metody sady Python Metody souborů Python Klíčová slova Pythonu Výjimky v Pythonu Slovník Pythonu

Reference modulu

Náhodný modul Modul požadavků Modul statistiky Matematický modul cMath modul

Jak na to Python

Odebrat duplikáty seznamu Obrátit řetězec Přidejte dvě čísla

Příklady Pythonu

Příklady Pythonu Kompilátor Pythonu Cvičení Python Pythonský kvíz Python certifikát

Požadavky Pythonu. Objekt odpovědi

❮ Modul požadavků


Příklad

Zadejte požadavek na webovou stránku a vraťte stavový kód:

import requests

x = requests.get('https://w3schools.com')
print(x.status_code)

Definice a použití

Objekt requests.Response()obsahuje odpověď serveru na požadavek HTTP.


Vlastnosti a metody

Property/Method Description
apparent_encoding Returns the apparent encoding
close() Closes the connection to the server
content Returns the content of the response, in bytes
cookies Returns a CookieJar object with the cookies sent back from the server
elapsed Returns a timedelta object with the time elapsed from sending the request to the arrival of the response
encoding Returns the encoding used to decode r.text
headers Returns a dictionary of response headers
history Returns a list of response objects holding the history of request (url)
is_permanent_redirect Returns True if the response is the permanent redirected url, otherwise False
is_redirect Returns True if the response was redirected, otherwise False
iter_content() Iterates over the response
iter_lines() Iterates over the lines of the response
json() Returns a JSON object of the result (if the result was written in JSON format, if not it raises an error)
links Returns the header links
next Returns a PreparedRequest object for the next request in a redirection
ok Returns True if status_code is less than 400, otherwise False
raise_for_status() If an error occur, this method returns a HTTPError object
reason Returns a text corresponding to the status code
request Returns the request object that requested this response
status_code Returns a number that indicates the status (200 is OK, 404 is Not Found)
text Returns the content of the response, in unicode
url Returns the URL of the response

❮ Modul požadavků