Exemple #1
0
 def create_pull_zone(self):
     """
     We will use the NetDNA RWS Library
     https://developer.netdna.com/docs/sample-code/python/
     https://developer.netdna.com/api/docs#pcreatePullZone
     """
     api = NetDNA(self.rws_alias, self.rws_key, self.rws_secret)
     createZone = api.post(
         "/zones/pull.json",
         {
             "name": self.bucket_name[:10],
             "url": "http://%s.objects.dreamhost.com" % (self.bucket_name,),
             "compress": "1",
         },
     )
     self.cdn_url = createZone["data"]["pullzone"]["tmp_url"]
     print createZone
Exemple #2
0
			
			print 'found maxcdn.consumer_secret'
		
		else:
		
			print '.maxcdn config file missing consumer_secret'
			
			sys.exit()
	
	else:
	
		print 'No maxcdn section in .maxcdn config file'
		
		sys.exit()

else:

	print 'No .maxcdn config file in user directory'
	
	sys.exit()

from netdnarws import NetDNA

api = NetDNA(MAXCDN_ALIAS, MAXCDN_CONSUMER_KEY, MAXCDN_CONSUMER_SECRET)

for f in paths_to_purge:

	api.delete('/zones/pull.json/33242/cache?file=' + f, debug=True)

print "\nSUCCESS\n"
#!/usr/bin/python

#arguments
import sys
arguments = sys.argv[1:]

# simple script to purge maxcdn website(s)
from netdnarws import NetDNA
api = NetDNA("alias", "key", "secret")
zones = []
zones.extend([111111])  # Zone ID

for zone_id in zones:
    api.delete("/zones/pull.json/%i/cache" % zone_id)
    print("Zone with ID %i purged." % zone_id)
#!/usr/bin/python

#arguments
import sys
arguments = sys.argv[1:]

# simple script to purge maxcdn website(s)
from netdnarws import NetDNA
api = NetDNA("alias", "key", "secret")
zones = []
zones.extend([111111]) # Zone ID


for zone_id in zones:
	api.delete("/zones/pull.json/%i/cache" % zone_id)
	print("Zone with ID %i purged." % zone_id)