Unofficial Python3 api wrapper for noip.com targeting users with free accounts. Everything is included in a single Python file, making integration into your project effortless.
- Checking the state of your active noip hostnames and confirming those expiring in 7 days. You can create a cron script to confirm expiring hostnames after every 23 days.
- Adding new hostnames
- Deleting a hostname, and
- Updating a hostname
- python-slugify
- google-auth
- google-auth-oauthlib
- google-auth-httplib2
- google-api-python-client
- Sometimes NO-IP sends verification code to registered email during login flow
- The API can handle this automatically when using Gmail
- Set Up Google Cloud Project and Enable Gmail API with OAuth consent screen set to 'External' user type; application type set to 'Desktop app'; and your gmail account added to the list of testers (search how to or ask Chat GPT) then replace 'self.credentials_json_path' with the path to your own credentials json file that you downloaded when creating 'OAuth 2.0 Credentials'
Initialize client
fromnoip_apiimportnoIPnoip=noIP(email, password) You can then access noip attributes
Retrieves active noip hostnames and updates those expiring in 7 days
Example:
noip.checkMyHostnames()Creates the given hostname in the given domain using one of the 4 record types: ipv4 (A), ipv6 (AAA), cname, and web redirect. The default domain and record type are 'ddns.net' and 'ipv4', respectively.
Takesthefollowingarguments:
hostname: Aprefixofadomainnamee.g. 'api'without'ddns.net'.
domain: Thehosttoattachthenewhostnametoe.g. 'ddns.net'. Thedefaultdomainis'ddns.net'Checkthenoipwebsiteforavailablefreehosts.
record_type: Therecord type tousewhencreatinganewhostname.
Validoptionsare: 'ipv4', 'ipv6', 'cname', and'web-redirect'. 'ipv4'isusedasthedefaultifnoneisspecified. Recordtypeisalsoinferedfrom'ipv4', 'ipv6', 'cname', and'web-redirect-url'options. E.g., if'ipv6'isprovided, the'ipv6'record_typeisautomaticallyused.
{ipv4}: 'ipv4'addressrequiredifthisrecordtypeisselected, currentipisusedasthedefault.
{ipv6}: both'ipv4'and'ipv6'addressesarerequiredwhenthisrecordtypeisselected, currentipisusedasthedefault.
{cname}: requiresthe'cname'e.g. 'example.domain.com'.
{web-redirect}: requirestheurloripv4addresswheretheurlwillredirect.
ipv4: Theipv4adddress. Currentaddressisusedwhennotprovided. Requiredforboth'ipv4'(A) and'ipv6'(AAAA) recordtypes.
ipv6: Theipv6address. Requiredforthe'ipv6'(AAAA) recordtype.
cname: Thecnamee.g. 'example.domain.com'. Requiredforthe'cname'recordtypeweb_redirect_url: Thefullweb_redirect_urlwithprotocole.g. 'https://example.com'or'http://10.67.1.1:8080/web'. Requiredfor'web-redirect'recordtype.
Usageexamples:
noip=noip(email, pass)
noip.addNewHostname('home-camera') #creates home-camera.ddns.net using current ipv4 address.noip.addNewHostname('home-camera', record-type='ipv6', ipv6='2001:0db8:85a3:0000:0000:8a2e:0370:7334'ipv4='30.5.7.8') #creates ipv6 record typenoip.addNewHostname('home-camera', ipv6='2001:0db8:85a3:0000:0000:8a2e:0370:7334') #creates ipv6 record type. The current ipv4 address is used.noip.addNewHostname('home-camera', ipv4='30.5.7.8') #creates home-camera.ddns.net using the provided ipv4 address, useful for remote servers.noip.addNewHostname('home-camera', record-type=cnamecname="example.com")
noip.addNewHostname('home-camera', record-type=web-redirectweb_redirect_url="https://example.com") #the web redirect record is created with the mask URL option unchecked.Serverresponseisprintedifhostnamecreationfailse.g. whentheprovidedhostnamealreadyexists.Deletes the given hostname from your noip account. Prints error message if deletion fails e.g. the provided hostname is not in your account.
Example:
noip.deleteHostname('example.ddns.net')Updates the given hostname with the given ip addresses. If no ip address is given, the current ip will be used.
Currently supports hostnames with record types 'ipv4(A) and 'ipv6'(AAAA) only.
Examples:
noip.updateHostname('example.ddns.net') #updates the given 'hostname' with current system ip addressnoip.updateHostname('example.ddns.net', ipv4='123.67.6.8') #updates the given 'hostname' with the given ipv4 addressnoip.updateHostname('example.ddns.net', ipv6='2001:0db8:85a3:0000:0000:8a2e:0370:7334') #updates the given 'hostname' with the given ipv6 address