Created
February 26, 2025 23:45
-
-
Save iiasceri/0c5391370550527e1ff9e2eeb2d1c820 to your computer and use it in GitHub Desktop.
code etsy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import threading | |
# Constants | |
URL = "https://openapi.etsy.com/etsyapps/v3/bespoke/member/listings/1850899944" | |
PARAMS = { | |
"listing_id": "1850899944", | |
"include_recommendations": "false", | |
"supports_google_pay": "true", | |
"show_more_review_images_carousel": "false", | |
"include_split_listing_shop_reviews_data": "true", | |
"show_only_listing_reviews": "false", | |
"include_is_shop_favorited": "true", | |
"include_featured_review": "true", | |
"high_frequency": "false", | |
"include_minimal_shop_sections": "false", | |
"include_all_snudge_coupon_types_android": "false" | |
} | |
HEADERS = { | |
"Accept-Encoding": "gzip", | |
"Connection": "Keep-Alive", | |
"Host": "openapi.etsy.com", | |
"oauth_version": "2.0", | |
"User-agent": "Dalvik/2.1.0 (Macos; U; Android 13; HD1910 Build/SKQ1.211113.001) Mobile/1 EtsyInc/7.14.0 Android/1", | |
"x-api-key": "gf665hj0kpsdkpllgek11zrz", | |
"X-App-In-Background": "true", | |
"X-Detected-Locale": "EUR|en-US|SP", | |
"X-Etsy-Device": "AMA4zpj7SRaVz12yhq_N_z", | |
"x-etsy-signed-body": "true", | |
"X-Page-GUID": "WcUBMU3dScedMFk7Z5CTdg" | |
} | |
def make_request(): | |
"""Make a single API request and handle exceptions""" | |
try: | |
response = requests.get(URL, params=PARAMS, headers=HEADERS) | |
response.raise_for_status() | |
print(response.json()) | |
except requests.exceptions.RequestException as e: | |
print(f"Request failed: {e}") | |
def worker(): | |
"""Worker thread function to continuously make requests""" | |
while True: | |
make_request() | |
def main(): | |
# Number of threads (adjust as needed) | |
num_threads = 12 | |
# Create and start threads | |
threads = [] | |
for _ in range(num_threads): | |
thread = threading.Thread(target=worker) | |
thread.daemon = True # Daemonize threads to exit when main thread exits | |
threads.append(thread) | |
thread.start() | |
# Keep main thread alive | |
try: | |
while True: | |
pass | |
except KeyboardInterrupt: | |
print("\nStopping threads...") | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment