mgkit.net.utils module¶
Utility functions for the network package
-
mgkit.net.utils.
url_open
(url, data=None, headers=None, agent=None, get=True, stream=False)[source]¶ Changed in version 0.3.4: now uses requests
- Parameters
url (str) – url to request
data (str) – parameters to pass to the request
headers (dict) – any additional headers
agent (str) – user agent to use
get (bool) – True if the request is a GET, False for POST
stream (bool) – returns an iterator to stream over
url – url to request
data – data to add to the request
compress (bool) – if the response should be compressed
agent – if supplied, the ‘User-Agent’ header we’ll be added to the request
- Returns
the response handle
-
mgkit.net.utils.
url_read
(url, data=None, agent=None, headers=None, get=True)[source]¶ Changed in version 0.3.4: now uses requests, removed compressed and added headers, get
Opens an URL and reads the
Wrapper of
url_open()
which reads the full response- Parameters
- Returns
the response data
- Return type