address_in_network() — requests Function Reference
Architecture documentation for the address_in_network() function in utils.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD 34b0e954_f61f_4779_0ea3_62759d4a4f26["address_in_network()"] 2c39b9da_e317_5e6c_bbac_8362bac2110c["utils.py"] 34b0e954_f61f_4779_0ea3_62759d4a4f26 -->|defined in| 2c39b9da_e317_5e6c_bbac_8362bac2110c c32589ad_d9fc_2a46_ebec_d0e98c4eb814["should_bypass_proxies()"] c32589ad_d9fc_2a46_ebec_d0e98c4eb814 -->|calls| 34b0e954_f61f_4779_0ea3_62759d4a4f26 d9bcc783_1d0f_9e64_5fcb_6cf40bd58dba["dotted_netmask()"] 34b0e954_f61f_4779_0ea3_62759d4a4f26 -->|calls| d9bcc783_1d0f_9e64_5fcb_6cf40bd58dba style 34b0e954_f61f_4779_0ea3_62759d4a4f26 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/utils.py lines 670–682
def address_in_network(ip, net):
"""This function allows you to check if an IP belongs to a network subnet
Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
returns False if ip = 192.168.1.1 and net = 192.168.100.0/24
:rtype: bool
"""
ipaddr = struct.unpack("=L", socket.inet_aton(ip))[0]
netaddr, bits = net.split("/")
netmask = struct.unpack("=L", socket.inet_aton(dotted_netmask(int(bits))))[0]
network = struct.unpack("=L", socket.inet_aton(netaddr))[0] & netmask
return (ipaddr & netmask) == (network & netmask)
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does address_in_network() do?
address_in_network() is a function in the requests codebase, defined in src/requests/utils.py.
Where is address_in_network() defined?
address_in_network() is defined in src/requests/utils.py at line 670.
What does address_in_network() call?
address_in_network() calls 1 function(s): dotted_netmask.
What calls address_in_network()?
address_in_network() is called by 1 function(s): should_bypass_proxies.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free