0% found this document useful (0 votes)
17 views

Sim 5 Request API Script

The document provides Python code for interacting with the 5sim.net API to fetch user profile data, request activation codes, and check the status of those requests. It includes functions to handle API requests with error handling and token authentication. The code demonstrates how to wait for a code review to complete by periodically checking the status until it is marked as completed.

Uploaded by

jasirjabbar789
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Sim 5 Request API Script

The document provides Python code for interacting with the 5sim.net API to fetch user profile data, request activation codes, and check the status of those requests. It includes functions to handle API requests with error handling and token authentication. The code demonstrates how to wait for a code review to complete by periodically checking the status until it is marked as completed.

Uploaded by

jasirjabbar789
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Sim5 Net

Profile Data

import requests

def fetch_user_profile(token):
# Define the API endpoint
url = 'https://5sim.net/v1/user/profile'

# Set up the headers with the provided token


headers = {
'Authorization': 'Bearer ' + token,
'Accept': 'application/json',
}

try:
# Make the GET request to the API
response = requests.get(url, headers=headers)

# Check if the request was successful


if response.status_code == 200:
# Return the JSON response
return response.json()
else:
# Print an error message if the request failed
return f"Error: {response.status_code} - {response.text}"
except requests.RequestException as e:
# Handle any exceptions that occurred during the request
return f"An error occurred: {e}"

if __name__ == '__main__':
# Replace 'Your token' with your actual token
token = 'Your token'

# Fetch user profile data


profile_data = fetch_user_profile(token)

# Print the profile data


print(profile_data)

Request Number (you can change country by your wish)

import requests

# API token
token = 'Your Token'

# Parameters
country = 'russia'
operator = 'any'
product = 'amazon'

# Set up the headers with the provided token


headers = {
'Authorization': 'Bearer ' + token,
'Accept': 'application/json',
}

# Construct the URL for the API request


url = f'https://5sim.net/v1/user/buy/activation/{country}/{operator}/{product}'

# Make the GET request to the API


response = requests.get(url, headers=headers)

# Check if the request was successful


if response.status_code == 200:
# Print the response JSON if the request was successful
print(response.json())
else:
# Print an error message if the request failed
print(f"Error: {response.status_code} - {response.text}")

Request to get code from number

import requests
import time

# API token
token = 'Your token'

# ID for checking the status


id = 1

# Set up the headers with the provided token


headers = {
'Authorization': 'Bearer ' + token,
'Accept': 'application/json',
}

# URL for the status check


status_url = f'https://5sim.net/v1/user/check/{id}'

def check_status():
try:
# Make the GET request to check the status
response = requests.get(status_url, headers=headers)

# Check if the request was successful


if response.status_code == 200:
data = response.json()
# Assuming 'status' is a key in the response JSON indicating review
status
# Adjust according to actual response structure
if data.get('status') == 'completed': # Replace with the actual status
value indicating completion
return True, data
else:
return False, data
else:
return False, f"Error: {response.status_code} - {response.text}"
except requests.RequestException as e:
return False, f"An error occurred: {e}"
def wait_for_review():
while True:
completed, result = check_status()
if completed:
print("Code review completed:", result)
break
else:
print("Waiting for code review to complete...")
print(result)
time.sleep(30) # Wait for 30 seconds before checking again

# Start the process


wait_for_review()

You might also like