Skip to content

Instantly share code, notes, and snippets.

@webprice
Last active January 30, 2022 16:55
Show Gist options
  • Save webprice/168a190721576ff6c1888845ad0b8f12 to your computer and use it in GitHub Desktop.
Save webprice/168a190721576ff6c1888845ad0b8f12 to your computer and use it in GitHub Desktop.
Python apps
#Register ddnames account
import pprint
import requests
#change email and password to yours data
email = "[email protected]"
password = "yourpassword"
dictToSend = {'email':email,'password': password}
res = requests.post('https://ddnames.com:8000/register', json=dictToSend)
print ('response from server:',res.status_code,":", res.text)
print("res,json",res.json())
pprint.pprint(res.json())
#Perform login and retrieve the Auth token
import pprint
import requests
#change email and password to yours data
email = "[email protected]"
password = "yourpassword"
pload = {"username":email,"password":password}
response = requests.post('https://ddnames.com:8000/login', data=pload)
print ('Status:',response.status_code)
pprint.pprint(response.json())
#Add domain to the Ddnames servers and database
import pprint
import requests
#CHANGE TOKEN, EMAIL, APIKEY, DOMAIN,IPADDRESS TO YOUR DATA
token= "your token here"
email = "[email protected]"
apikey = "your apikey here"
ipaddress = "3.3.3.3" #your ip here
domain= "your domain here"
pload = {"email":email,"apikey":apikey,"ipaddress":ipaddress,"domain":domain}
headers = {"Authorization": f"Bearer {token}"}
response = requests.post('https://ddnames.com:8000/add', json=pload,headers = headers)
print ('Status:',response.status_code)
pprint.pprint(response.json())
#Check account's information
import pprint
import requests
#CHANGE TOKEN, EMAIL, APIKEY TO YOUR DATA
token= "your token here"
email = "[email protected]"
apikey = "your apikey here"
pload = {"email":email,"apikey":apikey}
headers = {"Authorization": f"Bearer {token}"}
response = requests.get('https://ddnames:8000/check/', json=pload,headers = headers)
print ('Status:',response.status_code)
pprint.pprint(response.json())
#Send this from your device to
#Update IP address of your domain at ddnames.com
import pprint
import requests
#CHANGE TOKEN, EMAIL, APIKEY, DOMAIN,IPADDRESS TO YOUR DATA
#MAKE THIS SCRIPT AS A CRON JOB
ipaddress = get('http://fra.rastem.com.ua:80/ip.php').text.format() #this will get your current device's IP
token= "yourtokenhere"
email = "[email protected]"
apikey = "yourapikey"
domain = "yourdomain.com"
pload = {"email":email,"apikey":apikey,"domain":domain,"ipaddress":ipaddress}
headers = {"Authorization": f"Bearer {token}"}
response = requests.post('https://ddnames:8000/update', json=pload, headers=headers)
print ('Status:',response.status_code)
pprint.pprint(response.json())
#Delete domain from ddnames.com servers and DataBase
import pprint
import requests
#CHANGE TOKEN, EMAIL, APIKEY,DOMAIN_REMOED TO YOUR DATA
token= "your token here"
email = "[email protected]"
apikey = "your apikey here"
#DOMAIN YOU WANT TO REMOVE:
domain_removed = "your domain here"
pload = {"email":email,"apikey":apikey,"domain_removed":domain_removed}
headers = {"Authorization": f"Bearer {token}"}
response = requests.delete('https://ddnames:8000/delete/', json=pload,headers = headers)
print ('Status:',response.status_code)
pprint.pprint(response.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment