chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
49e09660-1e5d-4c1e-8789-3a92c7b171c6 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,496 | supabase-export-v2 | 2dadeba069e497c3 | There are two methods for getting input from a window:
* :meth:`~curses.window.getch` refreshes the screen and then waits for
the user to hit a key, displaying the key if :func:`~curses.echo` has been
called earlier. You can optionally specify a coordinate to which
the cursor should be moved before pausing. | trusted_official_docs | CPython Docs | There are two methods for getting input from a window:
* :meth:`~curses.window.getch` refreshes the screen and then waits for
the user to hit a key, displaying the key if :func:`~curses.echo` has been
called earlier. You can optionally specify a coordinate to which
the cursor should be moved before pausing. | There are two methods for getting input from a window:
* :meth:`~curses.window.getch` refreshes the screen and then waits for
the user to hit a key, displaying the key if :func:`~curses.echo` has been
called earlier. You can optionally specify a coordinate to which
the cursor should be moved before pausing. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
50fa9e84-7416-4de7-8980-d064546bc394 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,486 | supabase-export-v2 | 06bd97f61ff1871e | stdscr.addstr("Pretty text", curses.color_pair(1)) stdscr.refresh()
As I said before, a color pair consists of a foreground and background color. The ``init_pair(n, f, b)`` function changes the definition of color pair *n*, to
foreground color f and background color b. Color pair 0 is hard-wired to white
on black, and ... | trusted_official_docs | CPython Docs | stdscr.addstr("Pretty text", curses.color_pair(1)) stdscr.refresh()
As I said before, a color pair consists of a foreground and background color. The ``init_pair(n, f, b)`` function changes the definition of color pair *n*, to
foreground color f and background color b. Color pair 0 is hard-wired to white
on black, and ... | stdscr.addstr("Pretty text", curses.color_pair(1)) stdscr.refresh()
As I said before, a color pair consists of a foreground and background color. The ``init_pair(n, f, b)`` function changes the definition of color pair *n*, to
foreground color f and background color b. Color pair 0 is hard-wired to white
on black, and ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5412bc65-be85-43ee-bc05-be0021d566ae | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,483 | supabase-export-v2 | b53ee8510daf32c3 | the Canadian/British spelling 'colour'. If you're used to the British spelling, you'll have to resign yourself to misspelling it for the sake of these functions.)
The curses library maintains a finite number of color pairs, containing a
foreground (or text) color and a background color. You can get the attribute
value ... | trusted_official_docs | CPython Docs | the Canadian/British spelling 'colour'. If you're used to the British spelling, you'll have to resign yourself to misspelling it for the sake of these functions.)
The curses library maintains a finite number of color pairs, containing a
foreground (or text) color and a background color. You can get the attribute
value ... | the Canadian/British spelling 'colour'. If you're used to the British spelling, you'll have to resign yourself to misspelling it for the sake of these functions.)
The curses library maintains a finite number of color pairs, containing a
foreground (or text) color and a background color. You can get the attribute
value ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
541d863f-4bce-447e-a822-d32a5264e771 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,435 | supabase-export-v2 | b833d58bfcee9a2d | curses.cbreak()
Terminals usually return special keys, such as the cursor keys or navigation
keys such as Page Up and Home, as a multibyte escape sequence. While you could
write your application to expect such sequences and process them accordingly,
curses can do it for you, returning a special value such as
:const:`cu... | trusted_official_docs | CPython Docs | curses.cbreak()
Terminals usually return special keys, such as the cursor keys or navigation
keys such as Page Up and Home, as a multibyte escape sequence. While you could
write your application to expect such sequences and process them accordingly,
curses can do it for you, returning a special value such as
:const:`cu... | curses.cbreak()
Terminals usually return special keys, such as the cursor keys or navigation
keys such as Page Up and Home, as a multibyte escape sequence. While you could
write your application to expect such sequences and process them accordingly,
curses can do it for you, returning a special value such as
:const:`cu... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
56be1059-2fed-4c67-9ed2-b861b2de424f | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,451 | supabase-export-v2 | ccd66786d79495b6 | object represents a rectangular area of the screen, and supports methods to display text, erase it, allow the user to input strings, and so forth.
The ``stdscr`` object returned by the :func:`~curses.initscr` function is a
window object that covers the entire screen. Many programs may need
only this single window, but ... | trusted_official_docs | CPython Docs | object represents a rectangular area of the screen, and supports methods to display text, erase it, allow the user to input strings, and so forth.
The ``stdscr`` object returned by the :func:`~curses.initscr` function is a
window object that covers the entire screen. Many programs may need
only this single window, but ... | object represents a rectangular area of the screen, and supports methods to display text, erase it, allow the user to input strings, and so forth.
The ``stdscr`` object returned by the :func:`~curses.initscr` function is a
window object that covers the entire screen. Many programs may need
only this single window, but ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
582bec50-ef32-4dc1-9067-e7ab0d2257dc | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,499 | supabase-export-v2 | 6d07ff58e12f25a8 | set a timer on each :meth:`!getch`; if no input becomes available within a specified delay (measured in tenths of a second), curses raises an exception.
The :meth:`!getch` method returns an integer; if it's between 0 and 255, it
represents the ASCII code of the key pressed. Values greater than 255 are
special keys such... | trusted_official_docs | CPython Docs | set a timer on each :meth:`!getch`; if no input becomes available within a specified delay (measured in tenths of a second), curses raises an exception.
The :meth:`!getch` method returns an integer; if it's between 0 and 255, it
represents the ASCII code of the key pressed. Values greater than 255 are
special keys such... | set a timer on each :meth:`!getch`; if no input becomes available within a specified delay (measured in tenths of a second), curses raises an exception.
The :meth:`!getch` method returns an integer; if it's between 0 and 255, it
represents the ASCII code of the key pressed. Values greater than 255 are
special keys such... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
60888daa-37ae-4188-b7db-cef5db8fde80 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,452 | supabase-export-v2 | af1001664f2d0d2d | in order to redraw or clear them separately. The :func:`~curses.newwin` function creates a new window of a given size, returning the new window object. ::
begin_x = 20; begin_y = 7
height = 5; width = 40
win = curses.newwin(height, width, begin_y, begin_x) | trusted_official_docs | CPython Docs | in order to redraw or clear them separately. The :func:`~curses.newwin` function creates a new window of a given size, returning the new window object. ::
begin_x = 20; begin_y = 7
height = 5; width = 40
win = curses.newwin(height, width, begin_y, begin_x) | in order to redraw or clear them separately. The :func:`~curses.newwin` function creates a new window of a given size, returning the new window object. ::
begin_x = 20; begin_y = 7
height = 5; width = 40
win = curses.newwin(height, width, begin_y, begin_x) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
612dab13-5c11-4438-84f7-7a5d7c95bdeb | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,469 | supabase-export-v2 | 655fb705c60e44f2 | *str* or *ch*, *attr* | Move to position *y,x* within the window, and | | | display *str* or *ch*, using attribute *attr* | +---------------------------------+-----------------------------------------------+
Attributes allow displaying text in highlighted forms such as boldface,
underline, reverse code, or in color. Th... | trusted_official_docs | CPython Docs | *str* or *ch*, *attr* | Move to position *y,x* within the window, and | | | display *str* or *ch*, using attribute *attr* | +---------------------------------+-----------------------------------------------+
Attributes allow displaying text in highlighted forms such as boldface,
underline, reverse code, or in color. Th... | *str* or *ch*, *attr* | Move to position *y,x* within the window, and | | | display *str* or *ch*, using attribute *attr* | +---------------------------------+-----------------------------------------------+
Attributes allow displaying text in highlighted forms such as boldface,
underline, reverse code, or in color. Th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6238e9e2-4d0f-42d7-8e8a-d2c2d8ada05b | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,473 | supabase-export-v2 | 160c7128a23cad35 | a +/- symbol, and :const:`ACS_ULCORNER` is the upper left corner of a box (handy for drawing borders). You can also use the appropriate Unicode character.
Windows remember where the cursor was left after the last operation, so if you
leave out the *y,x* coordinates, the string or character will be displayed
wherever th... | trusted_official_docs | CPython Docs | a +/- symbol, and :const:`ACS_ULCORNER` is the upper left corner of a box (handy for drawing borders). You can also use the appropriate Unicode character.
Windows remember where the cursor was left after the last operation, so if you
leave out the *y,x* coordinates, the string or character will be displayed
wherever th... | a +/- symbol, and :const:`ACS_ULCORNER` is the upper left corner of a box (handy for drawing borders). You can also use the appropriate Unicode character.
Windows remember where the cursor was left after the last operation, so if you
leave out the *y,x* coordinates, the string or character will be displayed
wherever th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
730d6332-59b8-4ab4-83c3-73a3aa440bbc | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,498 | supabase-export-v2 | 7853cab32a8e9fd4 | characters are returned as 1-character strings, and special keys such as function keys return longer strings containing a key name such as ``KEY_UP`` or ``^G``.
It's possible to not wait for the user using the
:meth:`~curses.window.nodelay` window method. After ``nodelay(True)``,
:meth:`!getch` and :meth:`!getkey` for ... | trusted_official_docs | CPython Docs | characters are returned as 1-character strings, and special keys such as function keys return longer strings containing a key name such as ``KEY_UP`` or ``^G``.
It's possible to not wait for the user using the
:meth:`~curses.window.nodelay` window method. After ``nodelay(True)``,
:meth:`!getch` and :meth:`!getkey` for ... | characters are returned as 1-character strings, and special keys such as function keys return longer strings containing a key name such as ``KEY_UP`` or ``^G``.
It's possible to not wait for the user using the
:meth:`~curses.window.nodelay` window method. After ``nodelay(True)``,
:meth:`!getch` and :meth:`!getkey` for ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
730db8f5-dfab-4625-ba93-be48f7d64fcd | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,422 | supabase-export-v2 | c3b3a0b52715f134 | run an X server. Another is tools such as OS installers and kernel configurators that may have to run before any graphical support is available.
The curses library provides fairly basic functionality, providing the
programmer with an abstraction of a display containing multiple
non-overlapping windows of text. The cont... | trusted_official_docs | CPython Docs | run an X server. Another is tools such as OS installers and kernel configurators that may have to run before any graphical support is available.
The curses library provides fairly basic functionality, providing the
programmer with an abstraction of a display containing multiple
non-overlapping windows of text. The cont... | run an X server. Another is tools such as OS installers and kernel configurators that may have to run before any graphical support is available.
The curses library provides fairly basic functionality, providing the
programmer with an abstraction of a display containing multiple
non-overlapping windows of text. The cont... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7bcced10-bab8-4536-94ee-721f30273d12 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,457 | supabase-export-v2 | 4bc34d8e12ca74e9 | your program displays some text in a window and then clears the window, there's no need to send the original text because they're never visible.
In practice, explicitly telling curses to redraw a window doesn't
really complicate programming with curses much. Most programs go into a flurry
of activity, and then pause wa... | trusted_official_docs | CPython Docs | your program displays some text in a window and then clears the window, there's no need to send the original text because they're never visible.
In practice, explicitly telling curses to redraw a window doesn't
really complicate programming with curses much. Most programs go into a flurry
of activity, and then pause wa... | your program displays some text in a window and then clears the window, there's no need to send the original text because they're never visible.
In practice, explicitly telling curses to redraw a window doesn't
really complicate programming with curses much. Most programs go into a flurry
of activity, and then pause wa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
83a6bbb5-3548-4bc5-80b0-804b8b71a6e8 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,503 | supabase-export-v2 | 959cc27de69d29ed | available are the backspace key and the Enter key, which terminates the string. It can optionally be limited to a fixed number of characters. ::
curses.echo() # Enable echoing of characters | trusted_official_docs | CPython Docs | available are the backspace key and the Enter key, which terminates the string. It can optionally be limited to a fixed number of characters. ::
curses.echo() # Enable echoing of characters | available are the backspace key and the Enter key, which terminates the string. It can optionally be limited to a fixed number of characters. ::
curses.echo() # Enable echoing of characters | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
84bbbaeb-4cde-478f-8a27-e860e3624f57 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,484 | supabase-export-v2 | 330144a8185e266b | the :func:`~curses.color_pair` function; this can be bitwise-OR'ed with other attributes such as :const:`A_REVERSE`, but again, such combinations are not guaranteed to work on all terminals.
An example, which displays a line of text using color pair 1:: | trusted_official_docs | CPython Docs | the :func:`~curses.color_pair` function; this can be bitwise-OR'ed with other attributes such as :const:`A_REVERSE`, but again, such combinations are not guaranteed to work on all terminals.
An example, which displays a line of text using color pair 1:: | the :func:`~curses.color_pair` function; this can be bitwise-OR'ed with other attributes such as :const:`A_REVERSE`, but again, such combinations are not guaranteed to work on all terminals.
An example, which displays a line of text using color pair 1:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
85cee893-b8a4-4fa2-a8a6-49c4e6d725ea | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,492 | supabase-export-v2 | adfec819a09cb505 | stdscr.addstr(0,0, "RED ALERT!", curses.color_pair(1))
Very fancy terminals can change the definitions of the actual colors to a given
RGB value. This lets you change color 1, which is usually red, to purple or
blue or any other color you like. Unfortunately, the Linux console doesn't
support this, so I'm unable to try... | trusted_official_docs | CPython Docs | stdscr.addstr(0,0, "RED ALERT!", curses.color_pair(1))
Very fancy terminals can change the definitions of the actual colors to a given
RGB value. This lets you change color 1, which is usually red, to purple or
blue or any other color you like. Unfortunately, the Linux console doesn't
support this, so I'm unable to try... | stdscr.addstr(0,0, "RED ALERT!", curses.color_pair(1))
Very fancy terminals can change the definitions of the actual colors to a given
RGB value. This lets you change color 1, which is usually red, to purple or
blue or any other color you like. Unfortunately, the Linux console doesn't
support this, so I'm unable to try... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8e95a816-7be6-4d3b-b783-bd961123ed05 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,490 | supabase-export-v2 | 1b02dbeecb4a2f91 | curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)
When you change a color pair, any text already displayed using that color pair
will change to the new colors. You can also display new text in this color
with:: | trusted_official_docs | CPython Docs | curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)
When you change a color pair, any text already displayed using that color pair
will change to the new colors. You can also display new text in this color
with:: | curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)
When you change a color pair, any text already displayed using that color pair
will change to the new colors. You can also display new text in this color
with:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
92985b22-218d-4c10-95b5-08acd8141987 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,476 | supabase-export-v2 | 4acd0fc30acb3107 | Attributes and Color --------------------
Characters can be displayed in different ways. Status lines in a text-based
application are commonly shown in reverse video, or a text viewer may need to
highlight certain words. curses supports this by allowing you to specify an
attribute for each cell on the screen. | trusted_official_docs | CPython Docs | Attributes and Color --------------------
Characters can be displayed in different ways. Status lines in a text-based
application are commonly shown in reverse video, or a text viewer may need to
highlight certain words. curses supports this by allowing you to specify an
attribute for each cell on the screen. | Attributes and Color --------------------
Characters can be displayed in different ways. Status lines in a text-based
application are commonly shown in reverse video, or a text viewer may need to
highlight certain words. curses supports this by allowing you to specify an
attribute for each cell on the screen. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
92c330be-2930-40fa-9b67-bd4785ea653c | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,497 | supabase-export-v2 | 1cd310a5b5910460 | key, displaying the key if :func:`~curses.echo` has been called earlier. You can optionally specify a coordinate to which the cursor should be moved before pausing.
* :meth:`~curses.window.getkey` does the same thing but converts the
integer to a string. Individual characters are returned as
1-character strings, and ... | trusted_official_docs | CPython Docs | key, displaying the key if :func:`~curses.echo` has been called earlier. You can optionally specify a coordinate to which the cursor should be moved before pausing.
* :meth:`~curses.window.getkey` does the same thing but converts the
integer to a string. Individual characters are returned as
1-character strings, and ... | key, displaying the key if :func:`~curses.echo` has been called earlier. You can optionally specify a coordinate to which the cursor should be moved before pausing.
* :meth:`~curses.window.getkey` does the same thing but converts the
integer to a string. Individual characters are returned as
1-character strings, and ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
98d63791-c25b-4ebf-8d13-4c4bd38f877a | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,477 | supabase-export-v2 | beedc25d6b6a1dd1 | a text viewer may need to highlight certain words. curses supports this by allowing you to specify an attribute for each cell on the screen.
An attribute is an integer, each bit representing a different
attribute. You can try to display text with multiple attribute bits
set, but curses doesn't guarantee that all the po... | trusted_official_docs | CPython Docs | a text viewer may need to highlight certain words. curses supports this by allowing you to specify an attribute for each cell on the screen.
An attribute is an integer, each bit representing a different
attribute. You can try to display text with multiple attribute bits
set, but curses doesn't guarantee that all the po... | a text viewer may need to highlight certain words. curses supports this by allowing you to specify an attribute for each cell on the screen.
An attribute is an integer, each bit representing a different
attribute. You can try to display text with multiple attribute bits
set, but curses doesn't guarantee that all the po... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
996c5618-d1f1-4e02-8552-8ac86023146d | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,501 | supabase-export-v2 | 446958e729222ec1 | stdscr.getch() if c == ord('p'): PrintDocument() elif c == ord('q'): break # Exit the while loop elif c == curses.KEY_HOME: x = y = 0
The :mod:`curses.ascii` module supplies ASCII class membership functions that
take either integer or 1-character string arguments; these may be useful in
writing more readable tests for ... | trusted_official_docs | CPython Docs | stdscr.getch() if c == ord('p'): PrintDocument() elif c == ord('q'): break # Exit the while loop elif c == curses.KEY_HOME: x = y = 0
The :mod:`curses.ascii` module supplies ASCII class membership functions that
take either integer or 1-character string arguments; these may be useful in
writing more readable tests for ... | stdscr.getch() if c == ord('p'): PrintDocument() elif c == ord('q'): break # Exit the while loop elif c == curses.KEY_HOME: x = y = 0
The :mod:`curses.ascii` module supplies ASCII class membership functions that
take either integer or 1-character string arguments; these may be useful in
writing more readable tests for ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ace8cf3-ae62-4c3b-8cb1-686d7e016ba3 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,463 | supabase-export-v2 | 895c945622d9c74b | more efficient way to update the screen and prevent annoying screen flicker as each part of the screen gets updated. :meth:`!refresh` actually does two things:
1) Calls the :meth:`~curses.window.noutrefresh` method of each window
to update an underlying data structure representing the desired
state of the screen. 2) ... | trusted_official_docs | CPython Docs | more efficient way to update the screen and prevent annoying screen flicker as each part of the screen gets updated. :meth:`!refresh` actually does two things:
1) Calls the :meth:`~curses.window.noutrefresh` method of each window
to update an underlying data structure representing the desired
state of the screen. 2) ... | more efficient way to update the screen and prevent annoying screen flicker as each part of the screen gets updated. :meth:`!refresh` actually does two things:
1) Calls the :meth:`~curses.window.noutrefresh` method of each window
to update an underlying data structure representing the desired
state of the screen. 2) ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a06d85e0-5eac-476e-b21c-9bc0cb80c812 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,472 | supabase-export-v2 | 20f635ad2ae58079 | The :meth:`~curses.window.addch` methods take a character, which can be either a string of length 1, a bytestring of length 1, or an integer.
Constants are provided for extension characters; these constants are
integers greater than 255. For example, :const:`ACS_PLMINUS` is a +/-
symbol, and :const:`ACS_ULCORNER` is th... | trusted_official_docs | CPython Docs | The :meth:`~curses.window.addch` methods take a character, which can be either a string of length 1, a bytestring of length 1, or an integer.
Constants are provided for extension characters; these constants are
integers greater than 255. For example, :const:`ACS_PLMINUS` is a +/-
symbol, and :const:`ACS_ULCORNER` is th... | The :meth:`~curses.window.addch` methods take a character, which can be either a string of length 1, a bytestring of length 1, or an integer.
Constants are provided for extension characters; these constants are
integers greater than 255. For example, :const:`ACS_PLMINUS` is a +/-
symbol, and :const:`ACS_ULCORNER` is th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a37aa6a0-7d73-499c-bba6-ba267999fb1e | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,516 | supabase-export-v2 | d4d0b6e544cbc995 | Unix vendor's. The manual pages will document any quirks, and provide complete lists of all the functions, attributes, and :ref:`ACS_\* <curses-acs-codes>` characters available to you.
Because the curses API is so large, some functions aren't supported in
the Python interface. Often this isn't because they're difficult... | trusted_official_docs | CPython Docs | Unix vendor's. The manual pages will document any quirks, and provide complete lists of all the functions, attributes, and :ref:`ACS_\* <curses-acs-codes>` characters available to you.
Because the curses API is so large, some functions aren't supported in
the Python interface. Often this isn't because they're difficult... | Unix vendor's. The manual pages will document any quirks, and provide complete lists of all the functions, attributes, and :ref:`ACS_\* <curses-acs-codes>` characters available to you.
Because the curses API is so large, some functions aren't supported in
the Python interface. Often this isn't because they're difficult... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a58888ac-4871-4748-9d03-adfe259ad78e | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,428 | supabase-export-v2 | bf6891977b8a870d | for that, see the Python library guide's section on ncurses, and the C manual pages for ncurses. It will, however, give you the basic ideas.
Starting and ending a curses application
======================================== | trusted_official_docs | CPython Docs | for that, see the Python library guide's section on ncurses, and the C manual pages for ncurses. It will, however, give you the basic ideas.
Starting and ending a curses application
======================================== | for that, see the Python library guide's section on ncurses, and the C manual pages for ncurses. It will, however, give you the basic ideas.
Starting and ending a curses application
======================================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a93f8594-4bb1-42ff-a9da-7a9da32604b6 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,442 | supabase-export-v2 | 605e97d9d5baa347 | and raises an uncaught exception. Keys are no longer echoed to the screen when you type them, for example, which makes using the shell difficult.
In Python you can avoid these complications and make debugging much easier by
importing the :func:`curses.wrapper` function and using it like this:: | trusted_official_docs | CPython Docs | and raises an uncaught exception. Keys are no longer echoed to the screen when you type them, for example, which makes using the shell difficult.
In Python you can avoid these complications and make debugging much easier by
importing the :func:`curses.wrapper` function and using it like this:: | and raises an uncaught exception. Keys are no longer echoed to the screen when you type them, for example, which makes using the shell difficult.
In Python you can avoid these complications and make debugging much easier by
importing the :func:`curses.wrapper` function and using it like this:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aeb5b8a1-7ac2-4432-b708-289e64a5b75f | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,453 | supabase-export-v2 | a91dd41d974b0e5b | begin_x = 20; begin_y = 7 height = 5; width = 40 win = curses.newwin(height, width, begin_y, begin_x)
Note that the coordinate system used in curses is unusual. Coordinates are always passed in the order *y,x*, and the top-left
corner of a window is coordinate (0,0). This breaks the normal
convention for handling coord... | trusted_official_docs | CPython Docs | begin_x = 20; begin_y = 7 height = 5; width = 40 win = curses.newwin(height, width, begin_y, begin_x)
Note that the coordinate system used in curses is unusual. Coordinates are always passed in the order *y,x*, and the top-left
corner of a window is coordinate (0,0). This breaks the normal
convention for handling coord... | begin_x = 20; begin_y = 7 height = 5; width = 40 win = curses.newwin(height, width, begin_y, begin_x)
Note that the coordinate system used in curses is unusual. Coordinates are always passed in the order *y,x*, and the top-left
corner of a window is coordinate (0,0). This breaks the normal
convention for handling coord... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b29abb35-8d9f-4a6d-85c3-731b1ddd0f82 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,470 | supabase-export-v2 | b4f4c3a6f4a3bfe8 | allow displaying text in highlighted forms such as boldface, underline, reverse code, or in color. They'll be explained in more detail in the next subsection.
The :meth:`~curses.window.addstr` method takes a Python string or
bytestring as the value to be displayed. The contents of bytestrings
are sent to the terminal a... | trusted_official_docs | CPython Docs | allow displaying text in highlighted forms such as boldface, underline, reverse code, or in color. They'll be explained in more detail in the next subsection.
The :meth:`~curses.window.addstr` method takes a Python string or
bytestring as the value to be displayed. The contents of bytestrings
are sent to the terminal a... | allow displaying text in highlighted forms such as boldface, underline, reverse code, or in color. They'll be explained in more detail in the next subsection.
The :meth:`~curses.window.addstr` method takes a Python string or
bytestring as the value to be displayed. The contents of bytestrings
are sent to the terminal a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bdeeea39-40cf-4465-937f-b988c45621d6 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,468 | supabase-export-v2 | 6437937a4e124a1c | these details. ``stdscr`` is a window object like any other, and methods such as :meth:`~curses.window.addstr` accept multiple argument forms. Usually there are four different forms.
+---------------------------------+-----------------------------------------------+
| Form | Description |
+=============================... | trusted_official_docs | CPython Docs | these details. ``stdscr`` is a window object like any other, and methods such as :meth:`~curses.window.addstr` accept multiple argument forms. Usually there are four different forms.
+---------------------------------+-----------------------------------------------+
| Form | Description |
+=============================... | these details. ``stdscr`` is a window object like any other, and methods such as :meth:`~curses.window.addstr` accept multiple argument forms. Usually there are four different forms.
+---------------------------------+-----------------------------------------------+
| Form | Description |
+=============================... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c2c994bd-745f-46e7-a4a4-f590d5d9ea8a | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,471 | supabase-export-v2 | b978d68b0fb5ccd6 | as-is. Strings are encoded to bytes using the value of the window's :attr:`~window.encoding` attribute; this defaults to the default system encoding as returned by :func:`locale.getencoding`.
The :meth:`~curses.window.addch` methods take a character, which can be
either a string of length 1, a bytestring of length 1, o... | trusted_official_docs | CPython Docs | as-is. Strings are encoded to bytes using the value of the window's :attr:`~window.encoding` attribute; this defaults to the default system encoding as returned by :func:`locale.getencoding`.
The :meth:`~curses.window.addch` methods take a character, which can be
either a string of length 1, a bytestring of length 1, o... | as-is. Strings are encoded to bytes using the value of the window's :attr:`~window.encoding` attribute; this defaults to the default system encoding as returned by :func:`locale.getencoding`.
The :meth:`~curses.window.addch` methods take a character, which can be
either a string of length 1, a bytestring of length 1, o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c47da90a-58fc-4ce0-b9b4-5598a118370b | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,423 | supabase-export-v2 | cd19103b88d2cc73 | curses doesn't provide many user-interface concepts such as buttons, checkboxes, or dialogs; if you need such features, consider a user interface library such as :pypi:`Urwid`.
The curses library was originally written for BSD Unix; the later System V
versions of Unix from AT&T added many enhancements and new functions... | trusted_official_docs | CPython Docs | curses doesn't provide many user-interface concepts such as buttons, checkboxes, or dialogs; if you need such features, consider a user interface library such as :pypi:`Urwid`.
The curses library was originally written for BSD Unix; the later System V
versions of Unix from AT&T added many enhancements and new functions... | curses doesn't provide many user-interface concepts such as buttons, checkboxes, or dialogs; if you need such features, consider a user interface library such as :pypi:`Urwid`.
The curses library was originally written for BSD Unix; the later System V
versions of Unix from AT&T added many enhancements and new functions... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c5ccf69c-dea0-449d-a9a7-0f62400efa35 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,461 | supabase-export-v2 | 99f5f212ef121b30 | pad content. # (20, 75) : coordinate of lower-right corner of window area to be # : filled with pad content. pad.refresh( 0,0, 5,5, 20,75)
The :meth:`!refresh` call displays a section of the pad in the rectangle
extending from coordinate (5,5) to coordinate (20,75) on the screen; the upper
left corner of the displayed ... | trusted_official_docs | CPython Docs | pad content. # (20, 75) : coordinate of lower-right corner of window area to be # : filled with pad content. pad.refresh( 0,0, 5,5, 20,75)
The :meth:`!refresh` call displays a section of the pad in the rectangle
extending from coordinate (5,5) to coordinate (20,75) on the screen; the upper
left corner of the displayed ... | pad content. # (20, 75) : coordinate of lower-right corner of window area to be # : filled with pad content. pad.refresh( 0,0, 5,5, 20,75)
The :meth:`!refresh` call displays a section of the pad in the rectangle
extending from coordinate (5,5) to coordinate (20,75) on the screen; the upper
left corner of the displayed ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cb136719-3fec-46d8-bf50-758f5c0d6934 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,441 | supabase-export-v2 | d57e847af6978325 | curses.endwin()
A common problem when debugging a curses application is to get your terminal
messed up when the application dies without restoring the terminal to its
previous state. In Python this commonly happens when your code is buggy and
raises an uncaught exception. Keys are no longer echoed to the screen when
yo... | trusted_official_docs | CPython Docs | curses.endwin()
A common problem when debugging a curses application is to get your terminal
messed up when the application dies without restoring the terminal to its
previous state. In Python this commonly happens when your code is buggy and
raises an uncaught exception. Keys are no longer echoed to the screen when
yo... | curses.endwin()
A common problem when debugging a curses application is to get your terminal
messed up when the application dies without restoring the terminal to its
previous state. In Python this commonly happens when your code is buggy and
raises an uncaught exception. Keys are no longer echoed to the screen when
yo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d33ac4a9-5bca-4aff-a5d8-f99560ccaed4 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,421 | supabase-export-v2 | 4084082075527edf | operations such as moving the cursor, scrolling the screen, and erasing areas. Different terminals use widely differing codes, and often have their own minor quirks.
In a world of graphical displays, one might ask "why bother"? It's
true that character-cell display terminals are an obsolete technology,
but there are ni... | trusted_official_docs | CPython Docs | operations such as moving the cursor, scrolling the screen, and erasing areas. Different terminals use widely differing codes, and often have their own minor quirks.
In a world of graphical displays, one might ask "why bother"? It's
true that character-cell display terminals are an obsolete technology,
but there are ni... | operations such as moving the cursor, scrolling the screen, and erasing areas. Different terminals use widely differing codes, and often have their own minor quirks.
In a world of graphical displays, one might ask "why bother"? It's
true that character-cell display terminals are an obsolete technology,
but there are ni... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3851dda-7e1f-445b-bc44-95d3231b896c | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,502 | supabase-export-v2 | 572a710026f1cb87 | conversion functions that take either integer or 1-character-string arguments and return the same type. For example, :func:`curses.ascii.ctrl` returns the control character corresponding to its argument.
There's also a method to retrieve an entire string,
:meth:`~curses.window.getstr`. It isn't used very often, because... | trusted_official_docs | CPython Docs | conversion functions that take either integer or 1-character-string arguments and return the same type. For example, :func:`curses.ascii.ctrl` returns the control character corresponding to its argument.
There's also a method to retrieve an entire string,
:meth:`~curses.window.getstr`. It isn't used very often, because... | conversion functions that take either integer or 1-character-string arguments and return the same type. For example, :func:`curses.ascii.ctrl` returns the control character corresponding to its argument.
There's also a method to retrieve an entire string,
:meth:`~curses.window.getstr`. It isn't used very often, because... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d5d5e0ff-2ddf-405c-9acf-b26986c4551d | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,447 | supabase-export-v2 | ef1ab987b6cb1265 | wrapper(main)
The :func:`~curses.wrapper` function takes a callable object and does the
initializations described above, also initializing colors if color
support is present. :func:`!wrapper` then runs your provided callable. Once the callable returns, :func:`!wrapper` will restore the original
state of the terminal. T... | trusted_official_docs | CPython Docs | wrapper(main)
The :func:`~curses.wrapper` function takes a callable object and does the
initializations described above, also initializing colors if color
support is present. :func:`!wrapper` then runs your provided callable. Once the callable returns, :func:`!wrapper` will restore the original
state of the terminal. T... | wrapper(main)
The :func:`~curses.wrapper` function takes a callable object and does the
initializations described above, also initializing colors if color
support is present. :func:`!wrapper` then runs your provided callable. Once the callable returns, :func:`!wrapper` will restore the original
state of the terminal. T... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d8dd5dd3-766e-4ffb-95c8-e8fe6fd1a0c0 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,474 | supabase-export-v2 | ab141f58f4719cfb | cursor is positioned in some location where it won't be distracting; it can be confusing to have the cursor blinking at some apparently random location.
If your application doesn't need a blinking cursor at all, you can
call ``curs_set(False)`` to make it invisible. For compatibility
with older curses versions, there's... | trusted_official_docs | CPython Docs | cursor is positioned in some location where it won't be distracting; it can be confusing to have the cursor blinking at some apparently random location.
If your application doesn't need a blinking cursor at all, you can
call ``curs_set(False)`` to make it invisible. For compatibility
with older curses versions, there's... | cursor is positioned in some location where it won't be distracting; it can be confusing to have the cursor blinking at some apparently random location.
If your application doesn't need a blinking cursor at all, you can
call ``curs_set(False)`` to make it invisible. For compatibility
with older curses versions, there's... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dcd1a4c8-d9be-47ae-b610-fe84ee8ae695 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,458 | supabase-export-v2 | 2a7e44f83617b651 | the screen has been redrawn before pausing to wait for user input, by first calling :meth:`!stdscr.refresh` or the :meth:`!refresh` method of some other relevant window.
A pad is a special case of a window; it can be larger than the actual display
screen, and only a portion of the pad displayed at a time. Creating a pa... | trusted_official_docs | CPython Docs | the screen has been redrawn before pausing to wait for user input, by first calling :meth:`!stdscr.refresh` or the :meth:`!refresh` method of some other relevant window.
A pad is a special case of a window; it can be larger than the actual display
screen, and only a portion of the pad displayed at a time. Creating a pa... | the screen has been redrawn before pausing to wait for user input, by first calling :meth:`!stdscr.refresh` or the :meth:`!refresh` method of some other relevant window.
A pad is a special case of a window; it can be larger than the actual display
screen, and only a portion of the pad displayed at a time. Creating a pa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dcd43d8c-3287-4e3a-86ab-58708c862ac3 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,460 | supabase-export-v2 | 958d6979f571b8d2 | letters; addch() is # explained in the next section for y in range(0, 99): for x in range(0, 99): pad.addch(y,x, ord('a') + (x*x+y*y) % 26)
# Displays a section of the pad in the middle of the screen. # (0,0) : coordinate of upper-left corner of pad area to display. # (5,5) : coordinate of upper-left corner of window a... | trusted_official_docs | CPython Docs | letters; addch() is # explained in the next section for y in range(0, 99): for x in range(0, 99): pad.addch(y,x, ord('a') + (x*x+y*y) % 26)
# Displays a section of the pad in the middle of the screen. # (0,0) : coordinate of upper-left corner of pad area to display. # (5,5) : coordinate of upper-left corner of window a... | letters; addch() is # explained in the next section for y in range(0, 99): for x in range(0, 99): pad.addch(y,x, ord('a') + (x*x+y*y) % 26)
# Displays a section of the pad in the middle of the screen. # (0,0) : coordinate of upper-left corner of pad area to display. # (5,5) : coordinate of upper-left corner of window a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dd75773f-9769-40cc-9a13-6b70b14406d1 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,517 | supabase-export-v2 | da69af7ea454903c | associated with ncurses. Patches adding support for these would be welcome; see `the Python Developer's Guide <https://devguide.python.org/>`_ to learn more about submitting patches to Python.
* `Writing Programs with NCURSES <https://invisible-island.net/ncurses/ncurses-intro.html>`_:
a lengthy tutorial for C program... | trusted_official_docs | CPython Docs | associated with ncurses. Patches adding support for these would be welcome; see `the Python Developer's Guide <https://devguide.python.org/>`_ to learn more about submitting patches to Python.
* `Writing Programs with NCURSES <https://invisible-island.net/ncurses/ncurses-intro.html>`_:
a lengthy tutorial for C program... | associated with ncurses. Patches adding support for these would be welcome; see `the Python Developer's Guide <https://devguide.python.org/>`_ to learn more about submitting patches to Python.
* `Writing Programs with NCURSES <https://invisible-island.net/ncurses/ncurses-intro.html>`_:
a lengthy tutorial for C program... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e243aa72-062e-4ff3-9b82-41bae1010dfd | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,454 | supabase-export-v2 | 3165a8a220390966 | difference from most other computer applications, but it's been part of curses since it was first written, and it's too late to change things now.
Your application can determine the size of the screen by using the
:data:`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and
*x* sizes. Legal coordinates ... | trusted_official_docs | CPython Docs | difference from most other computer applications, but it's been part of curses since it was first written, and it's too late to change things now.
Your application can determine the size of the screen by using the
:data:`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and
*x* sizes. Legal coordinates ... | difference from most other computer applications, but it's been part of curses since it was first written, and it's too late to change things now.
Your application can determine the size of the screen by using the
:data:`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and
*x* sizes. Legal coordinates ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e36fa744-c6b5-4063-a660-aceaefaeeada | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,455 | supabase-export-v2 | 343194408d6d685f | :data:`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and *x* sizes. Legal coordinates will then extend from ``(0,0)`` to ``(curses.LINES - 1, curses.COLS - 1)``.
When you call a method to display or erase text, the effect doesn't
immediately show up on the display. Instead you must call the
:meth:`~... | trusted_official_docs | CPython Docs | :data:`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and *x* sizes. Legal coordinates will then extend from ``(0,0)`` to ``(curses.LINES - 1, curses.COLS - 1)``.
When you call a method to display or erase text, the effect doesn't
immediately show up on the display. Instead you must call the
:meth:`~... | :data:`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and *x* sizes. Legal coordinates will then extend from ``(0,0)`` to ``(curses.LINES - 1, curses.COLS - 1)``.
When you call a method to display or erase text, the effect doesn't
immediately show up on the display. Instead you must call the
:meth:`~... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e3b1683e-87ff-4bee-b3a3-ec084477c617 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,462 | supabase-export-v2 | fdf4fd00e8433cdd | corner of the displayed section is coordinate (0,0) on the pad. Beyond that difference, pads are exactly like ordinary windows and support the same methods.
If you have multiple windows and pads on screen there is a more
efficient way to update the screen and prevent annoying screen flicker
as each part of the screen g... | trusted_official_docs | CPython Docs | corner of the displayed section is coordinate (0,0) on the pad. Beyond that difference, pads are exactly like ordinary windows and support the same methods.
If you have multiple windows and pads on screen there is a more
efficient way to update the screen and prevent annoying screen flicker
as each part of the screen g... | corner of the displayed section is coordinate (0,0) on the pad. Beyond that difference, pads are exactly like ordinary windows and support the same methods.
If you have multiple windows and pads on screen there is a more
efficient way to update the screen and prevent annoying screen flicker
as each part of the screen g... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1b258a7-6657-4741-99a4-a667da022438 | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,456 | supabase-export-v2 | dca8d38c8426f440 | erase text, the effect doesn't immediately show up on the display. Instead you must call the :meth:`~curses.window.refresh` method of window objects to update the screen.
This is because curses was originally written with slow 300-baud
terminal connections in mind; with these terminals, minimizing the
time required to ... | trusted_official_docs | CPython Docs | erase text, the effect doesn't immediately show up on the display. Instead you must call the :meth:`~curses.window.refresh` method of window objects to update the screen.
This is because curses was originally written with slow 300-baud
terminal connections in mind; with these terminals, minimizing the
time required to ... | erase text, the effect doesn't immediately show up on the display. Instead you must call the :meth:`~curses.window.refresh` method of window objects to update the screen.
This is because curses was originally written with slow 300-baud
terminal connections in mind; with these terminals, minimizing the
time required to ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f63fbb1b-0b73-4ed1-b068-ea9df779705b | CPython Docs | file://datasets/cpython/Doc/howto/curses.rst | unknown | 53ade08c-250b-4ab0-a598-0fe49dbb660f | 59,426 | supabase-export-v2 | 655775f3891e23d1 | The Python curses module ------------------------
The Python module is a fairly simple wrapper over the C functions provided by
curses; if you're already familiar with curses programming in C, it's really
easy to transfer that knowledge to Python. The biggest difference is that the
Python interface makes things simpler... | trusted_official_docs | CPython Docs | The Python curses module ------------------------
The Python module is a fairly simple wrapper over the C functions provided by
curses; if you're already familiar with curses programming in C, it's really
easy to transfer that knowledge to Python. The biggest difference is that the
Python interface makes things simpler... | The Python curses module ------------------------
The Python module is a fairly simple wrapper over the C functions provided by
curses; if you're already familiar with curses programming in C, it's really
easy to transfer that knowledge to Python. The biggest difference is that the
Python interface makes things simpler... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09efc62d-535d-45b2-8e6a-bc2431541ca6 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,533 | supabase-export-v2 | 43dd2d5cfb0f43d9 | Free-threaded builds of CPython support optionally running with the GIL enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or the command-line option :option:`-X gil`.
The GIL may also automatically be enabled when importing a C-API extension
module that is not explicitly marked as supporting free t... | trusted_official_docs | CPython Docs | Free-threaded builds of CPython support optionally running with the GIL enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or the command-line option :option:`-X gil`.
The GIL may also automatically be enabled when importing a C-API extension
module that is not explicitly marked as supporting free t... | Free-threaded builds of CPython support optionally running with the GIL enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or the command-line option :option:`-X gil`.
The GIL may also automatically be enabled when importing a C-API extension
module that is not explicitly marked as supporting free t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
11246d10-096f-4b7c-a31d-f85092e6f34c | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,543 | supabase-export-v2 | 24cafcfac8e53e7e | Immortalization ---------------
In the free-threaded build, some objects are :term:`immortal`. Immortal objects are not deallocated and have reference counts that are
never modified. This is done to avoid reference count contention that would
prevent efficient multi-threaded scaling. | trusted_official_docs | CPython Docs | Immortalization ---------------
In the free-threaded build, some objects are :term:`immortal`. Immortal objects are not deallocated and have reference counts that are
never modified. This is done to avoid reference count contention that would
prevent efficient multi-threaded scaling. | Immortalization ---------------
In the free-threaded build, some objects are :term:`immortal`. Immortal objects are not deallocated and have reference counts that are
never modified. This is done to avoid reference count contention that would
prevent efficient multi-threaded scaling. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1a66d8ad-20eb-4efc-a135-7d85788ad4c3 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,551 | supabase-export-v2 | c75e3adedd25deec | Single-threaded performance ---------------------------
The free-threaded build has additional overhead when executing Python code
compared to the default GIL-enabled build. The amount of overhead depends
on the workload and hardware. On the pyperformance benchmark suite, the
average overhead ranges from about 1% on ma... | trusted_official_docs | CPython Docs | Single-threaded performance ---------------------------
The free-threaded build has additional overhead when executing Python code
compared to the default GIL-enabled build. The amount of overhead depends
on the workload and hardware. On the pyperformance benchmark suite, the
average overhead ranges from about 1% on ma... | Single-threaded performance ---------------------------
The free-threaded build has additional overhead when executing Python code
compared to the default GIL-enabled build. The amount of overhead depends
on the workload and hardware. On the pyperformance benchmark suite, the
average overhead ranges from about 1% on ma... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
399a0a0e-f27f-463f-904c-a94ae482b3f3 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,527 | supabase-export-v2 | 046f5fbf0a4524f7 | For information on other platforms, see the `Installing a Free-Threaded Python <https://py-free-threading.github.io/installing-cpython/>`_, a community-maintained installation guide for installing free-threaded Python.
When building CPython from source, the :option:`--disable-gil` configure option
should be used to bui... | trusted_official_docs | CPython Docs | For information on other platforms, see the `Installing a Free-Threaded Python <https://py-free-threading.github.io/installing-cpython/>`_, a community-maintained installation guide for installing free-threaded Python.
When building CPython from source, the :option:`--disable-gil` configure option
should be used to bui... | For information on other platforms, see the `Installing a Free-Threaded Python <https://py-free-threading.github.io/installing-cpython/>`_, a community-maintained installation guide for installing free-threaded Python.
When building CPython from source, the :option:`--disable-gil` configure option
should be used to bui... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
43f3818e-9fdd-4326-bde1-fe47e0c84436 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,544 | supabase-export-v2 | ee09710b1ef8a878 | are not deallocated and have reference counts that are never modified. This is done to avoid reference count contention that would prevent efficient multi-threaded scaling.
As of the 3.14 release, immortalization is limited to: | trusted_official_docs | CPython Docs | are not deallocated and have reference counts that are never modified. This is done to avoid reference count contention that would prevent efficient multi-threaded scaling.
As of the 3.14 release, immortalization is limited to: | are not deallocated and have reference counts that are never modified. This is done to avoid reference count contention that would prevent efficient multi-threaded scaling.
As of the 3.14 release, immortalization is limited to: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
58e4d06c-8988-4a8b-8e69-f7bf53a01e4c | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,529 | supabase-export-v2 | 7a8b16b2407b2ea9 | Identifying free-threaded Python ================================
To check if the current interpreter supports free-threading, :option:`python -VV <-V>`
and :data:`sys.version` contain "free-threading build". The new :func:`sys._is_gil_enabled` function can be used to check whether
the GIL is actually disabled in the r... | trusted_official_docs | CPython Docs | Identifying free-threaded Python ================================
To check if the current interpreter supports free-threading, :option:`python -VV <-V>`
and :data:`sys.version` contain "free-threading build". The new :func:`sys._is_gil_enabled` function can be used to check whether
the GIL is actually disabled in the r... | Identifying free-threaded Python ================================
To check if the current interpreter supports free-threading, :option:`python -VV <-V>`
and :data:`sys.version` contain "free-threading build". The new :func:`sys._is_gil_enabled` function can be used to check whether
the GIL is actually disabled in the r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5e1cea43-e76d-4dd6-874a-d860a4f64f2a | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,534 | supabase-export-v2 | 574b41ca63671e20 | be enabled when importing a C-API extension module that is not explicitly marked as supporting free threading. A warning will be printed in this case.
In addition to individual package documentation, the following websites track
the status of popular packages support for free threading: | trusted_official_docs | CPython Docs | be enabled when importing a C-API extension module that is not explicitly marked as supporting free threading. A warning will be printed in this case.
In addition to individual package documentation, the following websites track
the status of popular packages support for free threading: | be enabled when importing a C-API extension module that is not explicitly marked as supporting free threading. A warning will be printed in this case.
In addition to individual package documentation, the following websites track
the status of popular packages support for free threading: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6222b694-edea-471d-b89e-4391c07e3299 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,531 | supabase-export-v2 | ef14d8b30737e975 | If the variable is set to ``1``, then the build supports free threading. This is the recommended mechanism for decisions related to the build configuration.
The global interpreter lock in free-threaded Python
=================================================== | trusted_official_docs | CPython Docs | If the variable is set to ``1``, then the build supports free threading. This is the recommended mechanism for decisions related to the build configuration.
The global interpreter lock in free-threaded Python
=================================================== | If the variable is set to ``1``, then the build supports free threading. This is the recommended mechanism for decisions related to the build configuration.
The global interpreter lock in free-threaded Python
=================================================== | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6c3dbc3d-4669-43b1-9035-9237d227d15f | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,519 | supabase-export-v2 | 9874ecb50ec6cf42 | ********************************* Python support for free threading *********************************
Starting with the 3.13 release, CPython has support for a build of
Python called :term:`free threading` where the :term:`global interpreter lock`
(GIL) is disabled. Free-threaded execution allows for full utilization o... | trusted_official_docs | CPython Docs | ********************************* Python support for free threading *********************************
Starting with the 3.13 release, CPython has support for a build of
Python called :term:`free threading` where the :term:`global interpreter lock`
(GIL) is disabled. Free-threaded execution allows for full utilization o... | ********************************* Python support for free threading *********************************
Starting with the 3.13 release, CPython has support for a build of
Python called :term:`free threading` where the :term:`global interpreter lock`
(GIL) is disabled. Free-threaded execution allows for full utilization o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6e3c56aa-e5b9-41b9-a4c4-1d8237b46a33 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,532 | supabase-export-v2 | 3253a25c3a9e4f4b | The global interpreter lock in free-threaded Python ===================================================
Free-threaded builds of CPython support optionally running with the GIL enabled
at runtime using the environment variable :envvar:`PYTHON_GIL` or
the command-line option :option:`-X gil`. | trusted_official_docs | CPython Docs | The global interpreter lock in free-threaded Python ===================================================
Free-threaded builds of CPython support optionally running with the GIL enabled
at runtime using the environment variable :envvar:`PYTHON_GIL` or
the command-line option :option:`-X gil`. | The global interpreter lock in free-threaded Python ===================================================
Free-threaded builds of CPython support optionally running with the GIL enabled
at runtime using the environment variable :envvar:`PYTHON_GIL` or
the command-line option :option:`-X gil`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7936c773-9850-4389-9c5a-d22956a03d32 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,521 | supabase-export-v2 | 432d5ba154127e7b | Some third-party packages, in particular ones with an :term:`extension module`, may not be ready for use in a free-threaded build, and will re-enable the :term:`GIL`.
This document describes the implications of free threading
for Python code. See :ref:`freethreading-extensions-howto` for information on
how to write C e... | trusted_official_docs | CPython Docs | Some third-party packages, in particular ones with an :term:`extension module`, may not be ready for use in a free-threaded build, and will re-enable the :term:`GIL`.
This document describes the implications of free threading
for Python code. See :ref:`freethreading-extensions-howto` for information on
how to write C e... | Some third-party packages, in particular ones with an :term:`extension module`, may not be ready for use in a free-threaded build, and will re-enable the :term:`GIL`.
This document describes the implications of free threading
for Python code. See :ref:`freethreading-extensions-howto` for information on
how to write C e... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d00379e-23d7-425b-8a64-704db42299e3 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,530 | supabase-export-v2 | dd78a007d844c879 | <-V>` and :data:`sys.version` contain "free-threading build". The new :func:`sys._is_gil_enabled` function can be used to check whether the GIL is actually disabled in the running process.
The ``sysconfig.get_config_var("Py_GIL_DISABLED")`` configuration variable can
be used to determine whether the build supports free... | trusted_official_docs | CPython Docs | <-V>` and :data:`sys.version` contain "free-threading build". The new :func:`sys._is_gil_enabled` function can be used to check whether the GIL is actually disabled in the running process.
The ``sysconfig.get_config_var("Py_GIL_DISABLED")`` configuration variable can
be used to determine whether the build supports free... | <-V>` and :data:`sys.version` contain "free-threading build". The new :func:`sys._is_gil_enabled` function can be used to check whether the GIL is actually disabled in the running process.
The ``sysconfig.get_config_var("Py_GIL_DISABLED")`` configuration variable can
be used to determine whether the build supports free... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ba96d038-27b4-43fc-aa67-460c3b71912a | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,557 | supabase-export-v2 | 0ac87d36a3dc2c87 | Warning filters ---------------
In the free-threaded build, the flag :data:`~sys.flags.context_aware_warnings`
is set to true by default. In the default GIL-enabled build, the flag defaults
to false. If the flag is true then the :class:`warnings.catch_warnings`
context manager uses a context variable for warning filter... | trusted_official_docs | CPython Docs | Warning filters ---------------
In the free-threaded build, the flag :data:`~sys.flags.context_aware_warnings`
is set to true by default. In the default GIL-enabled build, the flag defaults
to false. If the flag is true then the :class:`warnings.catch_warnings`
context manager uses a context variable for warning filter... | Warning filters ---------------
In the free-threaded build, the flag :data:`~sys.flags.context_aware_warnings`
is set to true by default. In the default GIL-enabled build, the flag defaults
to false. If the flag is true then the :class:`warnings.catch_warnings`
context manager uses a context variable for warning filter... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bbd70f71-3cea-49e9-aa5f-c833ba90c9b4 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,555 | supabase-export-v2 | 2e7778a452066aee | Context variables -----------------
In the free-threaded build, the flag :data:`~sys.flags.thread_inherit_context`
is set to true by default which causes threads created with
:class:`threading.Thread` to start with a copy of the
:class:`~contextvars.Context()` of the caller of
:meth:`~threading.Thread.start`. In the de... | trusted_official_docs | CPython Docs | Context variables -----------------
In the free-threaded build, the flag :data:`~sys.flags.thread_inherit_context`
is set to true by default which causes threads created with
:class:`threading.Thread` to start with a copy of the
:class:`~contextvars.Context()` of the caller of
:meth:`~threading.Thread.start`. In the de... | Context variables -----------------
In the free-threaded build, the flag :data:`~sys.flags.thread_inherit_context`
is set to true by default which causes threads created with
:class:`threading.Thread` to start with a copy of the
:class:`~contextvars.Context()` of the caller of
:meth:`~threading.Thread.start`. In the de... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c8c57084-6582-4a0c-ab3f-3cc08329d56a | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,547 | supabase-export-v2 | 62dfc168362c2a7a | Frame objects -------------
It is not safe to access :attr:`frame.f_locals` from a :ref:`frame <frame-objects>`
object if that frame is currently executing in another thread, and doing so may
crash the interpreter. | trusted_official_docs | CPython Docs | Frame objects -------------
It is not safe to access :attr:`frame.f_locals` from a :ref:`frame <frame-objects>`
object if that frame is currently executing in another thread, and doing so may
crash the interpreter. | Frame objects -------------
It is not safe to access :attr:`frame.f_locals` from a :ref:`frame <frame-objects>`
object if that frame is currently executing in another thread, and doing so may
crash the interpreter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dcd2d886-bc5c-4ca8-ad11-34e76dcaa934 | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,537 | supabase-export-v2 | c8db58ede6b2031e | Thread safety =============
The free-threaded build of CPython aims to provide similar thread-safety
behavior at the Python level to the default GIL-enabled build. Built-in
types like :class:`dict`, :class:`list`, and :class:`set` use internal locks
to protect against concurrent modifications in ways that behave simila... | trusted_official_docs | CPython Docs | Thread safety =============
The free-threaded build of CPython aims to provide similar thread-safety
behavior at the Python level to the default GIL-enabled build. Built-in
types like :class:`dict`, :class:`list`, and :class:`set` use internal locks
to protect against concurrent modifications in ways that behave simila... | Thread safety =============
The free-threaded build of CPython aims to provide similar thread-safety
behavior at the Python level to the default GIL-enabled build. Built-in
types like :class:`dict`, :class:`list`, and :class:`set` use internal locks
to protect against concurrent modifications in ways that behave simila... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e86fd4ee-6366-4263-b227-c2c5b6f3cb4e | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,520 | supabase-export-v2 | ecdf33c23870ac57 | on available CPU cores. While not all software will benefit from this automatically, programs designed with threading in mind will run faster on multi-core hardware.
Some third-party packages, in particular ones
with an :term:`extension module`, may not be ready for use in a
free-threaded build, and will re-enable the ... | trusted_official_docs | CPython Docs | on available CPU cores. While not all software will benefit from this automatically, programs designed with threading in mind will run faster on multi-core hardware.
Some third-party packages, in particular ones
with an :term:`extension module`, may not be ready for use in a
free-threaded build, and will re-enable the ... | on available CPU cores. While not all software will benefit from this automatically, programs designed with threading in mind will run faster on multi-core hardware.
Some third-party packages, in particular ones
with an :term:`extension module`, may not be ready for use in a
free-threaded build, and will re-enable the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f1378134-0273-4e1b-9b91-701e5e2735ea | CPython Docs | file://datasets/cpython/Doc/howto/free-threading-python.rst | unknown | 9de9a0f5-a8c7-4d9b-abb8-eaa8d125d082 | 59,526 | supabase-export-v2 | 25e5dac1ae6fee31 | Starting with Python 3.13, the official macOS and Windows installers optionally support installing free-threaded Python binaries. The installers are available at https://www.python.org/downloads/.
For information on other platforms, see the `Installing a Free-Threaded Python
<https://py-free-threading.github.io/install... | trusted_official_docs | CPython Docs | Starting with Python 3.13, the official macOS and Windows installers optionally support installing free-threaded Python binaries. The installers are available at https://www.python.org/downloads/.
For information on other platforms, see the `Installing a Free-Threaded Python
<https://py-free-threading.github.io/install... | Starting with Python 3.13, the official macOS and Windows installers optionally support installing free-threaded Python binaries. The installers are available at https://www.python.org/downloads/.
For information on other platforms, see the `Installing a Free-Threaded Python
<https://py-free-threading.github.io/install... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
019c4216-37c1-49f5-99b5-6d0e4ab25710 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,647 | supabase-export-v2 | a6515d7dfbc037c4 | # create a password manager password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
# Add the username and password. # If we knew the realm, we could use it instead of None. top_level_url = "http://example.com/foo/"
password_mgr.add_password(None, top_level_url, username, password) | trusted_official_docs | CPython Docs | # create a password manager password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
# Add the username and password. # If we knew the realm, we could use it instead of None. top_level_url = "http://example.com/foo/"
password_mgr.add_password(None, top_level_url, username, password) | # create a password manager password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
# Add the username and password. # If we knew the realm, we could use it instead of None. top_level_url = "http://example.com/foo/"
password_mgr.add_password(None, top_level_url, username, password) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0436991c-b900-4de0-bc4e-fb95b7b710e9 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,571 | supabase-export-v2 | fbc412b6d0d6013e | import urllib.request with urllib.request.urlopen('http://python.org/') as response: html = response.read()
If you wish to retrieve a resource via URL and store it in a temporary
location, you can do so via the :func:`shutil.copyfileobj` and
:func:`tempfile.NamedTemporaryFile` functions:: | trusted_official_docs | CPython Docs | import urllib.request with urllib.request.urlopen('http://python.org/') as response: html = response.read()
If you wish to retrieve a resource via URL and store it in a temporary
location, you can do so via the :func:`shutil.copyfileobj` and
:func:`tempfile.NamedTemporaryFile` functions:: | import urllib.request with urllib.request.urlopen('http://python.org/') as response: html = response.read()
If you wish to retrieve a resource via URL and store it in a temporary
location, you can do so via the :func:`shutil.copyfileobj` and
:func:`tempfile.NamedTemporaryFile` functions:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
079db82d-2d0d-42ab-9582-d368c14fdd76 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,566 | supabase-export-v2 | bf78367754399a93 | more complex interface for handling common situations - like basic authentication, cookies, proxies and so on. These are provided by objects called handlers and openers.
urllib.request supports fetching URLs for many "URL schemes" (identified by the string
before the ``":"`` in URL - for example ``"ftp"`` is the URL sc... | trusted_official_docs | CPython Docs | more complex interface for handling common situations - like basic authentication, cookies, proxies and so on. These are provided by objects called handlers and openers.
urllib.request supports fetching URLs for many "URL schemes" (identified by the string
before the ``":"`` in URL - for example ``"ftp"`` is the URL sc... | more complex interface for handling common situations - like basic authentication, cookies, proxies and so on. These are provided by objects called handlers and openers.
urllib.request supports fetching URLs for many "URL schemes" (identified by the string
before the ``":"`` in URL - for example ``"ftp"`` is the URL sc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0c1de719-80ba-4b2c-a7d1-dd7084535ecd | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,653 | supabase-export-v2 | 837184fa34d24c54 | .. note::
In the above example we only supplied our ``HTTPBasicAuthHandler`` to
``build_opener``. By default openers have the handlers for normal situations
-- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy`
environment variable is set), ``UnknownHandler``, ``HTTPHandler``,
``HTTPDefaultErrorH... | trusted_official_docs | CPython Docs | .. note::
In the above example we only supplied our ``HTTPBasicAuthHandler`` to
``build_opener``. By default openers have the handlers for normal situations
-- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy`
environment variable is set), ``UnknownHandler``, ``HTTPHandler``,
``HTTPDefaultErrorH... | .. note::
In the above example we only supplied our ``HTTPBasicAuthHandler`` to
``build_opener``. By default openers have the handlers for normal situations
-- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy`
environment variable is set), ``UnknownHandler``, ``HTTPHandler``,
``HTTPDefaultErrorH... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
10f57ca1-b857-4d4a-98bc-187d3e3e4b01 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,631 | supabase-export-v2 | f6c3a27e1f25b10e | Openers and Handlers ====================
When you fetch a URL you use an opener (an instance of the perhaps
confusingly named :class:`urllib.request.OpenerDirector`). Normally we have been using
the default opener - via ``urlopen`` - but you can create custom
openers. Openers use handlers. All the "heavy lifting" is d... | trusted_official_docs | CPython Docs | Openers and Handlers ====================
When you fetch a URL you use an opener (an instance of the perhaps
confusingly named :class:`urllib.request.OpenerDirector`). Normally we have been using
the default opener - via ``urlopen`` - but you can create custom
openers. Openers use handlers. All the "heavy lifting" is d... | Openers and Handlers ====================
When you fetch a URL you use an opener (an instance of the perhaps
confusingly named :class:`urllib.request.OpenerDirector`). Normally we have been using
the default opener - via ``urlopen`` - but you can create custom
openers. Openers use handlers. All the "heavy lifting" is d... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1c35dd37-8f22-49f3-aaae-ceb0bc6be755 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,644 | supabase-export-v2 | a35b7d9e1476d797 | request. This is 'basic authentication'. In order to simplify this process we can create an instance of ``HTTPBasicAuthHandler`` and an opener to use this handler.
The ``HTTPBasicAuthHandler`` uses an object called a password manager to handle
the mapping of URLs and realms to passwords and usernames. If you know what ... | trusted_official_docs | CPython Docs | request. This is 'basic authentication'. In order to simplify this process we can create an instance of ``HTTPBasicAuthHandler`` and an opener to use this handler.
The ``HTTPBasicAuthHandler`` uses an object called a password manager to handle
the mapping of URLs and realms to passwords and usernames. If you know what ... | request. This is 'basic authentication'. In order to simplify this process we can create an instance of ``HTTPBasicAuthHandler`` and an opener to use this handler.
The ``HTTPBasicAuthHandler`` uses an object called a password manager to handle
the mapping of URLs and realms to passwords and usernames. If you know what ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1cc584b1-d61d-4862-be9f-c2d65ff46699 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,635 | supabase-export-v2 | c32fbd33cae5fd91 | objects with a single function call. ``build_opener`` adds several handlers by default, but provides a quick way to add more and/or override the default handlers.
Other sorts of handlers you might want to can handle proxies, authentication,
and other common but slightly specialised situations. | trusted_official_docs | CPython Docs | objects with a single function call. ``build_opener`` adds several handlers by default, but provides a quick way to add more and/or override the default handlers.
Other sorts of handlers you might want to can handle proxies, authentication,
and other common but slightly specialised situations. | objects with a single function call. ``build_opener`` adds several handlers by default, but provides a quick way to add more and/or override the default handlers.
Other sorts of handlers you might want to can handle proxies, authentication,
and other common but slightly specialised situations. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d57e77b-75f0-408e-8fc6-b224d1702ef7 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,565 | supabase-export-v2 | e59e6d9bc29ee685 | A tutorial on *Basic Authentication*, with examples in Python.
**urllib.request** is a Python module for fetching URLs
(Uniform Resource Locators). It offers a very simple interface, in the form of
the *urlopen* function. This is capable of fetching URLs using a variety of
different protocols. It also offers a slightly... | trusted_official_docs | CPython Docs | A tutorial on *Basic Authentication*, with examples in Python.
**urllib.request** is a Python module for fetching URLs
(Uniform Resource Locators). It offers a very simple interface, in the form of
the *urlopen* function. This is capable of fetching URLs using a variety of
different protocols. It also offers a slightly... | A tutorial on *Basic Authentication*, with examples in Python.
**urllib.request** is a Python module for fetching URLs
(Uniform Resource Locators). It offers a very simple interface, in the form of
the *urlopen* function. This is capable of fetching URLs using a variety of
different protocols. It also offers a slightly... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2114d65c-1ba4-49b6-b962-e8f0e79192c3 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,588 | supabase-export-v2 | d844dfa610d3b618 | Note that other encodings are sometimes required (e.g. for file upload from HTML forms - see `HTML Specification, Form Submission <https://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13>`_ for more details).
If you do not pass the ``data`` argument, urllib uses a **GET** request. One
way in which GET and POST req... | trusted_official_docs | CPython Docs | Note that other encodings are sometimes required (e.g. for file upload from HTML forms - see `HTML Specification, Form Submission <https://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13>`_ for more details).
If you do not pass the ``data`` argument, urllib uses a **GET** request. One
way in which GET and POST req... | Note that other encodings are sometimes required (e.g. for file upload from HTML forms - see `HTML Specification, Form Submission <https://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13>`_ for more details).
If you do not pass the ``data`` argument, urllib uses a **GET** request. One
way in which GET and POST req... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
22ddfded-dcad-4d51-bdb9-f5f6ac5c1a85 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,671 | supabase-export-v2 | bb5032875a5faf3e | proxy, which urllib picks up on. In order to test scripts with a localhost server, I have to prevent urllib from using the proxy. ..
[#] urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe
<https://code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-method/>`_. | trusted_official_docs | CPython Docs | proxy, which urllib picks up on. In order to test scripts with a localhost server, I have to prevent urllib from using the proxy. ..
[#] urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe
<https://code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-method/>`_. | proxy, which urllib picks up on. In order to test scripts with a localhost server, I have to prevent urllib from using the proxy. ..
[#] urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe
<https://code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-method/>`_. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
24329742-9589-4cf4-ae39-7dda939048bf | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,610 | supabase-export-v2 | e0c0b49a2cf07e15 | See section 10 of :rfc:`2616` for a reference on all the HTTP error codes.
The :exc:`~urllib.error.HTTPError` instance raised will have an integer 'code' attribute, which
corresponds to the error sent by the server. | trusted_official_docs | CPython Docs | See section 10 of :rfc:`2616` for a reference on all the HTTP error codes.
The :exc:`~urllib.error.HTTPError` instance raised will have an integer 'code' attribute, which
corresponds to the error sent by the server. | See section 10 of :rfc:`2616` for a reference on all the HTTP error codes.
The :exc:`~urllib.error.HTTPError` instance raised will have an integer 'code' attribute, which
corresponds to the error sent by the server. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
247415a2-9946-4f9c-a4c1-386cf09abbfa | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,612 | supabase-export-v2 | 1ad27504cd227cc0 | Error Codes ~~~~~~~~~~~
Because the default handlers handle redirects (codes in the 300 range), and
codes in the 100--299 range indicate success, you will usually only see error
codes in the 400--599 range. | trusted_official_docs | CPython Docs | Error Codes ~~~~~~~~~~~
Because the default handlers handle redirects (codes in the 300 range), and
codes in the 100--299 range indicate success, you will usually only see error
codes in the 400--599 range. | Error Codes ~~~~~~~~~~~
Because the default handlers handle redirects (codes in the 300 range), and
codes in the 100--299 range indicate success, you will usually only see error
codes in the 400--599 range. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b6e4ef7-219d-4387-8e4a-1e2925e305ff | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,654 | supabase-export-v2 | 363d091d2fd567f7 | for normal situations -- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy` environment variable is set), ``UnknownHandler``, ``HTTPHandler``, ``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``, ``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``.
``top_level_url`` is in fact *... | trusted_official_docs | CPython Docs | for normal situations -- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy` environment variable is set), ``UnknownHandler``, ``HTTPHandler``, ``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``, ``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``.
``top_level_url`` is in fact *... | for normal situations -- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy` environment variable is set), ``UnknownHandler``, ``HTTPHandler``, ``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``, ``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``.
``top_level_url`` is in fact *... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2f19cea3-6f85-4c7f-a928-f980f2ea8541 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,581 | supabase-export-v2 | e103eda5631d6868 | req = urllib.request.Request('ftp://example.com/')
In the case of HTTP, there are two extra things that Request objects allow you
to do: First, you can pass data to be sent to the server. Second, you can pass
extra information ("metadata") *about* the data or about the request itself, to
the server - this information i... | trusted_official_docs | CPython Docs | req = urllib.request.Request('ftp://example.com/')
In the case of HTTP, there are two extra things that Request objects allow you
to do: First, you can pass data to be sent to the server. Second, you can pass
extra information ("metadata") *about* the data or about the request itself, to
the server - this information i... | req = urllib.request.Request('ftp://example.com/')
In the case of HTTP, there are two extra things that Request objects allow you
to do: First, you can pass data to be sent to the server. Second, you can pass
extra information ("metadata") *about* the data or about the request itself, to
the server - this information i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
386f140c-a727-413a-86fa-dcbbcab99754 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,639 | supabase-export-v2 | ac200464de238cc4 | Basic Authentication ====================
To illustrate creating and installing a handler we will use the
``HTTPBasicAuthHandler``. For a more detailed discussion of this subject --
including an explanation of how Basic Authentication works - see the `Basic
Authentication Tutorial
<https://web.archive.org/web/202012151... | trusted_official_docs | CPython Docs | Basic Authentication ====================
To illustrate creating and installing a handler we will use the
``HTTPBasicAuthHandler``. For a more detailed discussion of this subject --
including an explanation of how Basic Authentication works - see the `Basic
Authentication Tutorial
<https://web.archive.org/web/202012151... | Basic Authentication ====================
To illustrate creating and installing a handler we will use the
``HTTPBasicAuthHandler``. For a more detailed discussion of this subject --
including an explanation of how Basic Authentication works - see the `Basic
Authentication Tutorial
<https://web.archive.org/web/202012151... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
39e77646-fefc-4c51-be43-d3df18fac293 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,597 | supabase-export-v2 | a28978b9a5848064 | url = 'http://www.someserver.com/cgi-bin/register.cgi' user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' values = {'name': 'Michael Foord', 'location': 'Northampton', 'language': 'Python' } headers = {'User-Agent': user_agent}
data = urllib.parse.urlencode(values)
data = data.encode('ascii')
req = urllib.reques... | trusted_official_docs | CPython Docs | url = 'http://www.someserver.com/cgi-bin/register.cgi' user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' values = {'name': 'Michael Foord', 'location': 'Northampton', 'language': 'Python' } headers = {'User-Agent': user_agent}
data = urllib.parse.urlencode(values)
data = data.encode('ascii')
req = urllib.reques... | url = 'http://www.someserver.com/cgi-bin/register.cgi' user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' values = {'name': 'Michael Foord', 'location': 'Northampton', 'language': 'Python' } headers = {'User-Agent': user_agent}
data = urllib.parse.urlencode(values)
data = data.encode('ascii')
req = urllib.reques... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3add1943-8121-4642-881a-02b0fc721809 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,589 | supabase-export-v2 | f9f968db64c19d19 | nor a POST requests from having no side-effects. Data can also be passed in an HTTP GET request by encoding it in the URL itself.
This is done as follows:: | trusted_official_docs | CPython Docs | nor a POST requests from having no side-effects. Data can also be passed in an HTTP GET request by encoding it in the URL itself.
This is done as follows:: | nor a POST requests from having no side-effects. Data can also be passed in an HTTP GET request by encoding it in the URL itself.
This is done as follows:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
462ffd6a-818b-4f02-b8fe-71172a223b59 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,604 | supabase-export-v2 | 0377542cf99a4a24 | URLError --------
Often, URLError is raised because there is no network connection (no route to
the specified server), or the specified server doesn't exist. In this case, the
exception raised will have a 'reason' attribute, which is a tuple containing an
error code and a text error message. | trusted_official_docs | CPython Docs | URLError --------
Often, URLError is raised because there is no network connection (no route to
the specified server), or the specified server doesn't exist. In this case, the
exception raised will have a 'reason' attribute, which is a tuple containing an
error code and a text error message. | URLError --------
Often, URLError is raised because there is no network connection (no route to
the specified server), or the specified server doesn't exist. In this case, the
exception raised will have a 'reason' attribute, which is a tuple containing an
error code and a text error message. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
46e6dc77-5f03-4c83-97aa-a0a9c82a0d03 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,586 | supabase-export-v2 | ff61fd78c3f84550 | url = 'http://www.someserver.com/cgi-bin/register.cgi' values = {'name' : 'Michael Foord', 'location' : 'Northampton', 'language' : 'Python' }
data = urllib.parse.urlencode(values)
data = data.encode('ascii') # data should be bytes
req = urllib.request.Request(url, data)
with urllib.request.urlopen(req) as response:... | trusted_official_docs | CPython Docs | url = 'http://www.someserver.com/cgi-bin/register.cgi' values = {'name' : 'Michael Foord', 'location' : 'Northampton', 'language' : 'Python' }
data = urllib.parse.urlencode(values)
data = data.encode('ascii') # data should be bytes
req = urllib.request.Request(url, data)
with urllib.request.urlopen(req) as response:... | url = 'http://www.someserver.com/cgi-bin/register.cgi' values = {'name' : 'Michael Foord', 'location' : 'Northampton', 'language' : 'Python' }
data = urllib.parse.urlencode(values)
data = data.encode('ascii') # data should be bytes
req = urllib.request.Request(url, data)
with urllib.request.urlopen(req) as response:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4a27ae6f-79f5-4a56-86f1-4cf0fbc61eb9 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,624 | supabase-export-v2 | e05501d750c7366a | ::
from urllib.request import Request, urlopen
from urllib.error import URLError
req = Request(someurl)
try:
response = urlopen(req)
except URLError as e:
if hasattr(e, 'reason'):
print('We failed to reach a server.')
print('Reason: ', e.reason)
elif hasattr(e, 'code'):
print('The server couldn\'t fulfill the... | trusted_official_docs | CPython Docs | ::
from urllib.request import Request, urlopen
from urllib.error import URLError
req = Request(someurl)
try:
response = urlopen(req)
except URLError as e:
if hasattr(e, 'reason'):
print('We failed to reach a server.')
print('Reason: ', e.reason)
elif hasattr(e, 'code'):
print('The server couldn\'t fulfill the... | ::
from urllib.request import Request, urlopen
from urllib.error import URLError
req = Request(someurl)
try:
response = urlopen(req)
except URLError as e:
if hasattr(e, 'reason'):
print('We failed to reach a server.')
print('Reason: ', e.reason)
elif hasattr(e, 'code'):
print('The server couldn\'t fulfill the... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b99b9e2-aa2c-454a-923e-f9486effcf1b | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,583 | supabase-export-v2 | 74cb84d38949991c | Data ----
Sometimes you want to send data to a URL (often the URL will refer to a CGI
(Common Gateway Interface) script or other web application). With HTTP,
this is often done using what's known as a **POST** request. This is often what
your browser does when you submit a HTML form that you filled in on the web. Not
a... | trusted_official_docs | CPython Docs | Data ----
Sometimes you want to send data to a URL (often the URL will refer to a CGI
(Common Gateway Interface) script or other web application). With HTTP,
this is often done using what's known as a **POST** request. This is often what
your browser does when you submit a HTML form that you filled in on the web. Not
a... | Data ----
Sometimes you want to send data to a URL (often the URL will refer to a CGI
(Common Gateway Interface) script or other web application). With HTTP,
this is often done using what's known as a **POST** request. This is often what
your browser does when you submit a HTML form that you filled in on the web. Not
a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4ba326a4-1874-4ce5-9c4e-b5fbc930c68d | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,643 | supabase-export-v2 | b0fc376b65cdfbb2 | WWW-Authenticate: Basic realm="cPanel Users"
The client should then retry the request with the appropriate name and password
for the realm included as a header in the request. This is 'basic
authentication'. In order to simplify this process we can create an instance of
``HTTPBasicAuthHandler`` and an opener to use thi... | trusted_official_docs | CPython Docs | WWW-Authenticate: Basic realm="cPanel Users"
The client should then retry the request with the appropriate name and password
for the realm included as a header in the request. This is 'basic
authentication'. In order to simplify this process we can create an instance of
``HTTPBasicAuthHandler`` and an opener to use thi... | WWW-Authenticate: Basic realm="cPanel Users"
The client should then retry the request with the appropriate name and password
for the realm included as a header in the request. This is 'basic
authentication'. In order to simplify this process we can create an instance of
``HTTPBasicAuthHandler`` and an opener to use thi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
515788cd-b87d-43da-8a41-d63e722912f6 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,633 | supabase-export-v2 | afc677abd031f734 | fetch URLs with specific handlers installed, for example to get an opener that handles cookies, or to get an opener that does not handle redirections.
To create an opener, instantiate an ``OpenerDirector``, and then call
``.add_handler(some_handler_instance)`` repeatedly. | trusted_official_docs | CPython Docs | fetch URLs with specific handlers installed, for example to get an opener that handles cookies, or to get an opener that does not handle redirections.
To create an opener, instantiate an ``OpenerDirector``, and then call
``.add_handler(some_handler_instance)`` repeatedly. | fetch URLs with specific handlers installed, for example to get an opener that handles cookies, or to get an opener that does not handle redirections.
To create an opener, instantiate an ``OpenerDirector``, and then call
``.add_handler(some_handler_instance)`` repeatedly. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5623ebca-8fe0-4f14-9a83-d34d93c15ab6 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,576 | supabase-export-v2 | 4bb8e75ccd053c9c | have used a URL starting with 'ftp:', 'file:', etc.). However, it's the purpose of this tutorial to explain the more complicated cases, concentrating on HTTP.
HTTP is based on requests and responses - the client makes requests and servers
send responses. urllib.request mirrors this with a ``Request`` object which repre... | trusted_official_docs | CPython Docs | have used a URL starting with 'ftp:', 'file:', etc.). However, it's the purpose of this tutorial to explain the more complicated cases, concentrating on HTTP.
HTTP is based on requests and responses - the client makes requests and servers
send responses. urllib.request mirrors this with a ``Request`` object which repre... | have used a URL starting with 'ftp:', 'file:', etc.). However, it's the purpose of this tutorial to explain the more complicated cases, concentrating on HTTP.
HTTP is based on requests and responses - the client makes requests and servers
send responses. urllib.request mirrors this with a ``Request`` object which repre... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
698ac1a7-fc55-4587-ab85-2c339a691eb4 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,629 | supabase-export-v2 | 2d33330dd53dc43d | **info** - this returns a dictionary-like object that describes the page fetched, particularly the headers sent by the server. It is currently an :class:`http.client.HTTPMessage` instance.
Typical headers include 'Content-length', 'Content-type', and so on. See the
`Quick Reference to HTTP Headers <https://jkorpela.fi/... | trusted_official_docs | CPython Docs | **info** - this returns a dictionary-like object that describes the page fetched, particularly the headers sent by the server. It is currently an :class:`http.client.HTTPMessage` instance.
Typical headers include 'Content-length', 'Content-type', and so on. See the
`Quick Reference to HTTP Headers <https://jkorpela.fi/... | **info** - this returns a dictionary-like object that describes the page fetched, particularly the headers sent by the server. It is currently an :class:`http.client.HTTPMessage` instance.
Typical headers include 'Content-length', 'Content-type', and so on. See the
`Quick Reference to HTTP Headers <https://jkorpela.fi/... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
720bc873-ab9e-4b03-8a54-855f065afda6 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,567 | supabase-export-v2 | c616595b57822884 | example ``"ftp"`` is the URL scheme of ``"ftp://python.org/"``) using their associated network protocols (e.g. FTP, HTTP). This tutorial focuses on the most common case, HTTP.
For straightforward situations *urlopen* is very easy to use. But as soon as you
encounter errors or non-trivial cases when opening HTTP URLs, y... | trusted_official_docs | CPython Docs | example ``"ftp"`` is the URL scheme of ``"ftp://python.org/"``) using their associated network protocols (e.g. FTP, HTTP). This tutorial focuses on the most common case, HTTP.
For straightforward situations *urlopen* is very easy to use. But as soon as you
encounter errors or non-trivial cases when opening HTTP URLs, y... | example ``"ftp"`` is the URL scheme of ``"ftp://python.org/"``) using their associated network protocols (e.g. FTP, HTTP). This tutorial focuses on the most common case, HTTP.
For straightforward situations *urlopen* is very easy to use. But as soon as you
encounter errors or non-trivial cases when opening HTTP URLs, y... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
752142a1-ec78-4b33-8965-52818930d945 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,579 | supabase-export-v2 | ba40e4bad94b782f | req = urllib.request.Request('http://python.org/') with urllib.request.urlopen(req) as response: the_page = response.read()
Note that urllib.request makes use of the same Request interface to handle all URL
schemes. For example, you can make an FTP request like so:: | trusted_official_docs | CPython Docs | req = urllib.request.Request('http://python.org/') with urllib.request.urlopen(req) as response: the_page = response.read()
Note that urllib.request makes use of the same Request interface to handle all URL
schemes. For example, you can make an FTP request like so:: | req = urllib.request.Request('http://python.org/') with urllib.request.urlopen(req) as response: the_page = response.read()
Note that urllib.request makes use of the same Request interface to handle all URL
schemes. For example, you can make an FTP request like so:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
78a3fc0b-886e-4823-8c8f-b02211121022 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,627 | supabase-export-v2 | 4e63789ab130199c | The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` instance) has two useful methods :meth:`!info` and :meth:`!geturl` and is defined in the module :mod:`urllib.response`.
* **geturl** - this returns the real URL of the page fetched. This is useful
because ``urlopen`` (or the opener object used) ma... | trusted_official_docs | CPython Docs | The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` instance) has two useful methods :meth:`!info` and :meth:`!geturl` and is defined in the module :mod:`urllib.response`.
* **geturl** - this returns the real URL of the page fetched. This is useful
because ``urlopen`` (or the opener object used) ma... | The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` instance) has two useful methods :meth:`!info` and :meth:`!geturl` and is defined in the module :mod:`urllib.response`.
* **geturl** - this returns the real URL of the page fetched. This is useful
because ``urlopen`` (or the opener object used) ma... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c9e67fe-ce8c-476e-92ed-bef9c9a1b5a5 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,587 | supabase-export-v2 | df578937193d67ec | data = urllib.parse.urlencode(values) data = data.encode('ascii') # data should be bytes req = urllib.request.Request(url, data) with urllib.request.urlopen(req) as response: the_page = response.read()
Note that other encodings are sometimes required (e.g. for file upload from HTML
forms - see `HTML Specification, Form... | trusted_official_docs | CPython Docs | data = urllib.parse.urlencode(values) data = data.encode('ascii') # data should be bytes req = urllib.request.Request(url, data) with urllib.request.urlopen(req) as response: the_page = response.read()
Note that other encodings are sometimes required (e.g. for file upload from HTML
forms - see `HTML Specification, Form... | data = urllib.parse.urlencode(values) data = data.encode('ascii') # data should be bytes req = urllib.request.Request(url, data) with urllib.request.urlopen(req) as response: the_page = response.read()
Note that other encodings are sometimes required (e.g. for file upload from HTML
forms - see `HTML Specification, Form... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7ff18757-6b86-49e3-90ce-9bc90a19abde | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,590 | supabase-export-v2 | d42d0ff4942f450c | This is done as follows::
>>> import urllib.request
>>> import urllib.parse
>>> data = {}
>>> data['name'] = 'Somebody Here'
>>> data['location'] = 'Northampton'
>>> data['language'] = 'Python'
>>> url_values = urllib.parse.urlencode(data)
>>> print(url_values) # The order may differ from below. #doctest: +SKIP
... | trusted_official_docs | CPython Docs | This is done as follows::
>>> import urllib.request
>>> import urllib.parse
>>> data = {}
>>> data['name'] = 'Somebody Here'
>>> data['location'] = 'Northampton'
>>> data['language'] = 'Python'
>>> url_values = urllib.parse.urlencode(data)
>>> print(url_values) # The order may differ from below. #doctest: +SKIP
... | This is done as follows::
>>> import urllib.request
>>> import urllib.parse
>>> data = {}
>>> data['name'] = 'Somebody Here'
>>> data['location'] = 'Northampton'
>>> data['language'] = 'Python'
>>> url_values = urllib.parse.urlencode(data)
>>> print(url_values) # The order may differ from below. #doctest: +SKIP
... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8137dc70-3189-430f-abe4-5d42e2611d8f | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,598 | supabase-export-v2 | 4fecafa010204bdf | data = urllib.parse.urlencode(values) data = data.encode('ascii') req = urllib.request.Request(url, data, headers) with urllib.request.urlopen(req) as response: the_page = response.read()
The response also has two useful methods. See the section on `info and geturl`_
which comes after we have a look at what happens whe... | trusted_official_docs | CPython Docs | data = urllib.parse.urlencode(values) data = data.encode('ascii') req = urllib.request.Request(url, data, headers) with urllib.request.urlopen(req) as response: the_page = response.read()
The response also has two useful methods. See the section on `info and geturl`_
which comes after we have a look at what happens whe... | data = urllib.parse.urlencode(values) data = data.encode('ascii') req = urllib.request.Request(url, data, headers) with urllib.request.urlopen(req) as response: the_page = response.read()
The response also has two useful methods. See the section on `info and geturl`_
which comes after we have a look at what happens whe... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
845acd5e-d5aa-4595-a409-031e162004e7 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,646 | supabase-export-v2 | 7bfa4751198cad8c | The top-level URL is the first URL that requires authentication. URLs "deeper" than the URL you pass to .add_password() will also match. ::
# create a password manager
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() | trusted_official_docs | CPython Docs | The top-level URL is the first URL that requires authentication. URLs "deeper" than the URL you pass to .add_password() will also match. ::
# create a password manager
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() | The top-level URL is the first URL that requires authentication. URLs "deeper" than the URL you pass to .add_password() will also match. ::
# create a password manager
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
998fde20-52e2-4d59-b03c-5a6f2e770c24 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,616 | supabase-export-v2 | 8d3d272dc7cc516c | page returned. This means that as well as the code attribute, it also has read, geturl, and info, methods as returned by the ``urllib.response`` module::
>>> req = urllib.request.Request('http://www.python.org/fish.html')
>>> try:
... urllib.request.urlopen(req)
... except urllib.error.HTTPError as e:
... print(e.c... | trusted_official_docs | CPython Docs | page returned. This means that as well as the code attribute, it also has read, geturl, and info, methods as returned by the ``urllib.response`` module::
>>> req = urllib.request.Request('http://www.python.org/fish.html')
>>> try:
... urllib.request.urlopen(req)
... except urllib.error.HTTPError as e:
... print(e.c... | page returned. This means that as well as the code attribute, it also has read, geturl, and info, methods as returned by the ``urllib.response`` module::
>>> req = urllib.request.Request('http://www.python.org/fish.html')
>>> try:
... urllib.request.urlopen(req)
... except urllib.error.HTTPError as e:
... print(e.c... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a2acb96c-7df9-4949-8c6f-d2c50baee663 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,594 | supabase-export-v2 | 2d3505cb2f5bc1ba | We'll discuss here one particular HTTP header, to illustrate how to add headers to your HTTP request.
Some websites [#]_ dislike being browsed by programs, or send different versions
to different browsers [#]_. By default urllib identifies itself as
``Python-urllib/x.y`` (where ``x`` and ``y`` are the major and minor v... | trusted_official_docs | CPython Docs | We'll discuss here one particular HTTP header, to illustrate how to add headers to your HTTP request.
Some websites [#]_ dislike being browsed by programs, or send different versions
to different browsers [#]_. By default urllib identifies itself as
``Python-urllib/x.y`` (where ``x`` and ``y`` are the major and minor v... | We'll discuss here one particular HTTP header, to illustrate how to add headers to your HTTP request.
Some websites [#]_ dislike being browsed by programs, or send different versions
to different browsers [#]_. By default urllib identifies itself as
``Python-urllib/x.y`` (where ``x`` and ``y`` are the major and minor v... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a48e4842-5c06-4b42-819a-8a584d490a49 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,572 | supabase-export-v2 | 78a69e6a653daf8d | you wish to retrieve a resource via URL and store it in a temporary location, you can do so via the :func:`shutil.copyfileobj` and :func:`tempfile.NamedTemporaryFile` functions::
import shutil
import tempfile
import urllib.request | trusted_official_docs | CPython Docs | you wish to retrieve a resource via URL and store it in a temporary location, you can do so via the :func:`shutil.copyfileobj` and :func:`tempfile.NamedTemporaryFile` functions::
import shutil
import tempfile
import urllib.request | you wish to retrieve a resource via URL and store it in a temporary location, you can do so via the :func:`shutil.copyfileobj` and :func:`tempfile.NamedTemporaryFile` functions::
import shutil
import tempfile
import urllib.request | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a5f8878d-1c85-41ef-8bdd-421e80f23e51 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,591 | supabase-export-v2 | c60a2bfa76c0049b | The order may differ from below. #doctest: +SKIP name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values >>> data = urllib.request.urlopen(full_url)
Notice that the full URL is created by adding a ``?`` to the URL, followed by
the enco... | trusted_official_docs | CPython Docs | The order may differ from below. #doctest: +SKIP name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values >>> data = urllib.request.urlopen(full_url)
Notice that the full URL is created by adding a ``?`` to the URL, followed by
the enco... | The order may differ from below. #doctest: +SKIP name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values >>> data = urllib.request.urlopen(full_url)
Notice that the full URL is created by adding a ``?`` to the URL, followed by
the enco... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a61a9f01-21b4-4268-8471-949dbe86b60a | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,645 | supabase-export-v2 | 6eaa59b64861e6ea | absence of you providing an alternative combination for a specific realm. We indicate this by providing ``None`` as the realm argument to the ``add_password`` method.
The top-level URL is the first URL that requires authentication. URLs "deeper"
than the URL you pass to .add_password() will also match. :: | trusted_official_docs | CPython Docs | absence of you providing an alternative combination for a specific realm. We indicate this by providing ``None`` as the realm argument to the ``add_password`` method.
The top-level URL is the first URL that requires authentication. URLs "deeper"
than the URL you pass to .add_password() will also match. :: | absence of you providing an alternative combination for a specific realm. We indicate this by providing ``None`` as the realm argument to the ``add_password`` method.
The top-level URL is the first URL that requires authentication. URLs "deeper"
than the URL you pass to .add_password() will also match. :: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a92cdbf5-62b9-4ae8-a652-d532184b2892 | CPython Docs | file://datasets/cpython/Doc/howto/urllib2.rst | unknown | aa8d37f0-3d3e-4a59-a1bf-c87811fcb425 | 59,664 | supabase-export-v2 | f865e220ff736d1c | The Python support for fetching resources from the web is layered. urllib uses the :mod:`http.client` library, which in turn uses the socket library.
As of Python 2.3 you can specify how long a socket should wait for a response
before timing out. This can be useful in applications which have to fetch web
pages. By defa... | trusted_official_docs | CPython Docs | The Python support for fetching resources from the web is layered. urllib uses the :mod:`http.client` library, which in turn uses the socket library.
As of Python 2.3 you can specify how long a socket should wait for a response
before timing out. This can be useful in applications which have to fetch web
pages. By defa... | The Python support for fetching resources from the web is layered. urllib uses the :mod:`http.client` library, which in turn uses the socket library.
As of Python 2.3 you can specify how long a socket should wait for a response
before timing out. This can be useful in applications which have to fetch web
pages. By defa... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.