Bläddra i källkod

remove paypal script and paypal keys

mk200789 10 år sedan
förälder
incheckning
ea6b7ecfe2

+ 0 - 120
hackathon_starter/hackathon/scripts/paypal.py

@@ -1,120 +0,0 @@
-
-'''
-paypal.py contains a handful of methods for interacting
-with Paypal data and returning the responses as JSON.
-'''
-
-import requests
-import simplejson as json2
-import unicodedata
-import urllib
-
-authorization_url = 'https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id='
-access_token_url  = 'https://api.sandbox.paypal.com/v1/oauth2/token'
-
-#password:testing123
-#cafe.mui-buyer@gmail.com
-#https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=AcOIP0f8NTl3iv5Etw2nakNrgPmjE65v84a2NQD5mm8-z-dTyhMSNHZuxHbHUaTAxLQIE0u-A2DFEY8M&response_type=code&scope=openid&redirect_uri=http://localhost:8000/hackathon/paypal/
-
-
-class PaypalOauthClient(object):
-	'''
-	Python Client for Paypal API.
-	'''
-
-	access_token = None
-	user_data = None
-	token_type = None
-	refresh_token = None
-
-	def __init__(self, client_id, client_secret):
-		'''
-		Parameters:
-			client_id: String
-				- The client_id from registering application
-				  on Instagram.
-			client_secret: String
-				- The client_secret from registering application
-				  on Instagram.
-		'''
-
-		self.client_id 		= client_id
-		self.client_secret 	= client_secret
-
-
-	def get_authorize_url(self):
-		''' 
-		Obtains authorize url link with given client_id.
-
-		Returns:
-			auth_url: String
-				- The authorization url.
-		'''
-
-		auth_url = authorization_url + self.client_id + '&response_type=code&scope=openid&redirect_uri=http://localhost:8000/hackathon/paypal/'
-		return auth_url
-
-
-	def get_access_token(self, code):
-		''' 
-		Obtains access token from authorization code.
-
-		Parameters:
-			code: String
-				- The code is retrieved from the authorization url parameter
-				  to obtain access_token.
-		'''
-
-		headers = {
-					'Accept': 'application/json',
-					'Accept-Language': 'en_US',
-					'content-type': 'application/x-www-form-urlencoded'
-				  }
-		data = { 'grant_type': 'authorization_code',
-				  'code': code,
-				  'redirect_uri':'http://localhost:8000/hackathon/paypal'}
-
-
-		req = requests.post(access_token_url, data=data, headers=headers, auth=(self.client_id, self.client_secret))
-		
-		if req.status_code != 200:
-			raise Exception("Invalid response %s." %  req.status_code)
-		
-		content = unicodedata.normalize('NFKD', req.text).encode('ascii','ignore')
-		jsonlist = json2.loads(content)
-
-		#print jsonlist
-		self.access_token = jsonlist['access_token']
-		self.token_type = jsonlist['token_type']
-		self.refresh_token = jsonlist['refresh_token']
-
-		return self.refresh_token
-
-
-	def get_refresh_token(self, refresh_token):
-		'''
-		This methods obtain new access token when current access_token expires.
-		'''
-
-		link  = 'https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice'
-
-		headers = {
-					'Accept': 'application/json',
-					'Accept-Language': 'en_US',
-					'content-type': 'application/x-www-form-urlencoded'
-				  }
-		data = { 'grant_type': 'refresh_token',
-				  'refresh_token': refresh_token}
-
-		req = requests.post(link, data=data, headers=headers, auth=(self.client_id, self.client_secret))
-		
-		if req.status_code != 200:
-			raise Exception("Invalid response %s." %  req.status_code)
-		
-		content = unicodedata.normalize('NFKD', req.text).encode('ascii','ignore')
-		jsonlist = json2.loads(content)
-
-		#print jsonlist
-		self.access_token = jsonlist['access_token']
-		self.token_type = jsonlist['token_type']
-

+ 0 - 2
hackathon_starter/hackathon_starter/settings.py

@@ -115,8 +115,6 @@ TWITTER_TOKEN = 'F05dgLAzHEOalb4K2xDQ8Umm8'
 TWITTER_SECRET = 'Yy3a74Z7gvyhxRruJsvUtUl8uK8iv6qKkVqbZSijUxK71Z1qTY'
 INSTAGRAM_CLIENT_ID = '77dc10b9e3624e908ce437c0a82da92e'
 INSTAGRAM_CLIENT_SECRET = '8bcf3139857149aaba7acaa61288427f'
-PAYPAL_CLIENT_ID = 'AcOIP0f8NTl3iv5Etw2nakNrgPmjE65v84a2NQD5mm8-z-dTyhMSNHZuxHbHUaTAxLQIE0u-A2DFEY8M'
-PAYPAL_CLIENT_SECRET = 'EOKz-tkbFfRZavSD8T70f961v3NHRVAXXJu-5MU97YqSVKBsUH4NOoy_xQ2Am3EU3lN2m5RQiVb3eI-3'
 
 GOOGLEMAP_API_KEY = 'AIzaSyA7tttML91EGZ32S_FOOoxu-mbxN9Ojds8'