import requests
# Proxy configuration
username = "YOUR_USERNAME"
password = "YOUR_PASSWORD"
endpoint = "YOUR_ENDPOINT"
proxy_url = f"http://{username}:{password}@{endpoint}"
proxies = {
"http": proxy_url,
"https": proxy_url
}
# Make a request
url = "http://google.com"
response = requests.get(url, proxies=proxies)
print(f"Status Code: {response.status_code}")
print(f"Content: {response.text}")
import requests
# Define the proxy server with IP and port
proxies = {
'http': 'http://YOUR_ENDPOINT',
'https': 'https://YOUR_ENDPOINT'
}
# Send a GET request using the proxy
response = requests.get('https://www.example.com', proxies=proxies)
# Check response status and print the content
print(response.status_code)
print(response.text)
import requests
from bs4 import BeautifulSoup
# Proxy configuration
username = "YOUR_USERNAME"
password = "YOUR_PASSWORD"
endpoint = "premium-residential.geonode.com:9001"
proxy_url = f"http://{username}:{password}@{endpoint}"
proxies = {
"http": proxy_url,
"https": proxy_url
}
# Make a request
url = "http://google.com"
response = requests.get(url, proxies=proxies)
s = BeautifulSoup(response.content, 'html.parser')
print(response.status_code)
print(s.text)
# From here you can process the data as needed
import requests
from bs4 import BeautifulSoup
# Geonode Proxy configuration
username = "YOUR_USERNAME" # Replace with your Geonode username
password = "YOUR_PASSWORD" # Replace with your Geonode password
endpoint = "premium-residential.geonode.com:9001"
proxy_url = f"http://{username}:{password}@{endpoint}"
proxies = {
"http": proxy_url,
"https": proxy_url
}
# Target URL
url = "http://books.toscrape.com/"
response = requests.get(url, proxies=proxies)
# Parse and extract data using BeautifulSoup
soup = BeautifulSoup(response.content, 'html.parser')
links = soup.find_all('a')
for link in links:
print(link.get('href'))
import requests
from bs4 import BeautifulSoup
# Geonode Proxy configuration
username = "YOUR_USERNAME" # Replace with your Geonode username
password = "YOUR_PASSWORD" # Replace with your Geonode password
endpoint = "premium-residential.geonode.com:9001" # Use assigned country-specific port if applicable
proxy_url = f"http://{username}:{password}@{endpoint}"
proxies = {
"http": proxy_url,
"https": proxy_url
}
response_ip = requests.get("https://httpbin.org/ip", proxies=proxies)
ip = response_ip.json()['origin']
# Get detailed info
response_info = requests.get(f"http://ipinfo.io/{ip}", proxies=proxies)
info = response_info.json()
print(f"IP: {info['ip']}")
print(f"Country: {info['country']}")
import requests
# Geonode Proxy configuration
username = "YOUR_USERNAME" # Replace with your Geonode username
password = "YOUR_PASSWORD" # Replace with your Geonode password
endpoint = "premium-residential.geonode.com:10000" # Sticky endpoint
proxy_url = f"http://{username}:{password}@{endpoint}"
proxies = {
"http": proxy_url,
"https": proxy_url
}
# Make request to check IP
response_ip = requests.get("https://httpbin.org/ip", proxies=proxies)
ip = response_ip.json()['origin']
# Get detailed info
response_info = requests.get(f"http://ipinfo.io/{ip}", proxies=proxies)
info = response_info.json()
print(f"IP: {info['ip']}")
print(f"Country: {info['country']}")
import pprint
import random
import requests
# Geonode Proxy configuration (replace with your own credentials)
username = "YOUR_USERNAME" # Replace with your Geonode username
password = "YOUR_PASSWRORD" # Replace with your Geonode password
def get_proxies_from_file(file_path):
"""Reads proxies from the specified file and returns a list of proxies."""
with open(file_path, 'r') as file:
proxies = [line.strip() for line in file.readlines()]
return proxies
def make_request_with_proxy(proxy):
"""Makes a request to check IP and fetches geolocation information."""
# Construct the proxy URL with authentication
proxy_url = f'http://{username}:{password}@{proxy}'
proxies = {
'http': proxy_url,
'https': proxy_url
}
# Get IP address from httpbin
ip_response = requests.get("https://httpbin.org/ip", proxies=proxies)
ip_data = ip_response.json()
print(f"IP Address: {ip_data['origin']}")
# Get detailed info from IP geolocation service
geo_response = requests.get("http://ipinfo.io", proxies=proxies)
pprint.pprint(geo_response.json())
def main():
proxy_file = 'RESIDENTIAL-PREMIUM-sticky.txt' # Path to your .txt file with Geonode proxies
proxies = get_proxies_from_file(proxy_file)
if not proxies:
print("No proxies found in the file.")
return
selected_proxy = random.choice(proxies)
print(f"Using proxy: {selected_proxy}")
make_request_with_proxy(selected_proxy)
if __name__ == "__main__":
main()
import requests
from bs4 import BeautifulSoup
# Geonode Proxy configuration
username = "YOUR_USERNAME" # Replace with your Geonode username
password = "YOUR_PASSWORD" # Replace with your Geonode password
endpoint = "premium-residential.geonode.com:10000" # Geonode endpoint for premium residential proxies
# Define the proxy URL
proxy_url = f"http://{username}:{password}@{endpoint}"
# Set up proxies
proxies = {
"http": proxy_url,
"https": proxy_url
}
# Define the URL to scrape
url = "http://books.toscrape.com/"
# Send a GET request through the Geonode proxy
response = requests.get(url, proxies=proxies)
# Parse the HTML content with BeautifulSoup
soup = BeautifulSoup(response.content, "html.parser")
# Find all the links on the web page
links = soup.find_all("a")
# Print each link found
for link in links:
print(link.get("href"))
scrapy runspider <Pythonfilename.py>
import requests
from bs4 import BeautifulSoup
from dataclasses import dataclass
from typing import Dict, Tuple
# Proxy configuration
PROXY_CONFIG = {
"host": "premium-residential.geonode.com",
"port": "10000",
"username": "YOUR_USERNAME", # Replace with your Geonode username
"password": "YOUR_PASSWORD" # Replace with your Geonode password
}
# Product URL
PRODUCT_URL = 'https://www.amazon.es/Taurus-WC12T-termoel%C3%A9ctrica-Aislamiento-Temperatura/dp/B093GXXKRL/ref=lp_14565165031_1_2'
@dataclass
class ProductInfo:
title: str
price: str
availability: str
def get_proxy_url(country: str) -> str:
# Generate Geonode proxy URL with country targeting
return f"http://{PROXY_CONFIG['username']}-country-{country}:{PROXY_CONFIG['password']}@{PROXY_CONFIG['host']}:{PROXY_CONFIG['port']}"
def get_headers() -> Dict[str, str]:
# HTTP headers to simulate a browser request
return {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36',
'Accept-Language': 'es-ES,es;q=0.9',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://www.amazon.es/'
}
def scrape_amazon(country: str) -> ProductInfo:
proxy_url = get_proxy_url(country)
proxies = {"http": proxy_url, "https": proxy_url}
try:
response = requests.get(PRODUCT_URL, proxies=proxies, headers=get_headers(), verify=False, timeout=30)
response.raise_for_status()
soup = BeautifulSoup(response.content, 'html.parser')
title = soup.select_one('#productTitle').text.strip() if soup.select_one('#productTitle') else "Title not found"
price = soup.select_one('.a-price-whole').text.strip() if soup.select_one('.a-price-whole') else "Price not found"
availability = soup.select_one('#availability span').text.strip() if soup.select_one('#availability span') else "Availability not found"
return ProductInfo(title, price, availability)
except requests.RequestException as e:
print(f"An error occurred while scraping with {country} IP: {str(e)}")
return ProductInfo("Error", "Error", "Error")
def main():
countries = {
"SPAIN": "es",
"PORTUGAL": "pt"
}
results = {country_code: scrape_amazon(country_code) for country_code in countries.values()}
for country_name, country_code in countries.items():
info = results[country_code]
print(f"\n{country_name} IP Results:")
print(f"Title: {info.title}")
print(f"Price: {info.price}€")
print(f"Availability: {info.availability}")
if __name__ == "__main__":
main()
import requests
api_key = 'YOUR_API_KEY'
target_url = 'https://httpbin.org/ip'
proxy_url = f'http://scrapeops:{api_key}@residential-proxy.scrapeops.io:8181'
proxies = {
'http': proxy_url,
'https': proxy_url,
}
response = requests.get(
url=target_url,
proxies=proxies,
timeout=120,
)
print('Body:', response.content)