Skip to content

Commit caa7d77

Browse files
author
Tim Martinak
committed
Remove dotenv & prefer pre-set shell env var; bump sdk version
1 parent ed6690e commit caa7d77

File tree

17 files changed

+87
-66
lines changed

17 files changed

+87
-66
lines changed

.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,4 @@ dist
101101
.tern-port
102102

103103
# dotnet
104-
*.sln
105-
106-
# Python
107-
.venv
108-
__pycache__
109-
110-
# Environment
111-
.env
104+
*.sln

advanced-integration/v2/server/python/.env.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

advanced-integration/v2/server/python/README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,35 @@ PayPal Standard Integration sample in Python using Flask
44

55
## Running the sample
66

7-
1. Setup a virtual environment
7+
1. **Setup a virtual environment**
88

99
```sh
10-
python3 -m vene .venv
10+
python3 -m venv .venv
1111
```
1212

13-
1. Install the dependencies
13+
1. **Install the dependencies**
1414

1515
```sh
1616
pip install -r requirements.txt
1717
```
1818

19-
1. Run the server
19+
1. **Add your API credentials to the environment:**
20+
21+
- **Windows**
22+
23+
```powershell
24+
$env:PAYPAL_CLIENT_ID = "<PAYPAL_CLIENT_ID>"
25+
$env:PAYPAL_CLIENT_SECRET = "<PAYPAL_CLIENT_SECRET>"
26+
```
27+
28+
- **Unix**
29+
30+
```bash
31+
export PAYPAL_CLIENT_ID="<PAYPAL_CLIENT_ID>"
32+
export PAYPAL_CLIENT_SECRET="<PAYPAL_CLIENT_SECRET>"
33+
```
34+
35+
1. **Run the server**
2036
2137
```sh
2238
flask --app server run
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
Flask==3.0.3
2-
paypal-server-sdk==0.5.1
3-
python-dotenv==1.0.1
2+
paypal-server-sdk==0.5.2

advanced-integration/v2/server/python/server.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import logging
22
import os
33

4-
from dotenv import load_dotenv
54
from flask import Flask, request
65
from paypalserversdk.http.auth.o_auth_2 import ClientCredentialsAuthCredentials
76
from paypalserversdk.logging.configuration.api_logging_configuration import LoggingConfiguration, \
@@ -16,8 +15,6 @@
1615

1716
app = Flask(__name__)
1817

19-
load_dotenv()
20-
2118
paypal_client: PaypalserversdkClient = PaypalserversdkClient(
2219
client_credentials_auth_credentials=ClientCredentialsAuthCredentials(
2320
o_auth_client_id=os.getenv('PAYPAL_CLIENT_ID'),

advanced-integration/v2/server/ruby/.env.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

advanced-integration/v2/server/ruby/Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
source "https://rubygems.org"
44

5-
gem "dotenv", "~> 3.1"
6-
gem "paypal-server-sdk", "~> 0.5.1"
5+
gem "paypal-server-sdk", "~> 0.5.2"
76
gem "puma", "~> 6.4"
87
gem "rackup", "~> 2.1"
98
gem "sinatra", "~> 4.0"

advanced-integration/v2/server/ruby/README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,33 @@ PayPal Standard Integration sample in Ruby using Sinatra
44

55
## Running the sample
66

7-
1. Ensure you have a supported Ruby version installed: [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/)
7+
1. **Ensure you have a supported Ruby version installed**: [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/)
88

9-
1. Install the dependencies
9+
1. **Install the dependencies**
1010

11-
```sh
11+
```bash
1212
bundle install
1313
```
1414

15-
1. Run the server
15+
1. **Add your API credentials to the environment:**
1616

17-
```sh
17+
- **Windows**
18+
19+
```powershell
20+
$env:PAYPAL_CLIENT_ID = "<PAYPAL_CLIENT_ID>"
21+
$env:PAYPAL_CLIENT_SECRET = "<PAYPAL_CLIENT_SECRET>"
22+
```
23+
24+
- **Unix**
25+
26+
```bash
27+
export PAYPAL_CLIENT_ID="<PAYPAL_CLIENT_ID>"
28+
export PAYPAL_CLIENT_SECRET="<PAYPAL_CLIENT_SECRET>"
29+
```
30+
31+
1. **Run the server**
32+
33+
```bash
1834
bundle exec ruby server.rb
1935
```
2036

advanced-integration/v2/server/ruby/server.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
require 'dotenv'
21
require 'paypal_server_sdk'
32
require 'sinatra'
43
require 'sinatra/json'
54

65
include PaypalServerSdk
76

8-
Dotenv.load(".env")
9-
107
set :port, 8080
118

129
paypal_client = PaypalServerSdk::Client.new(

standard-integration/server/python/.env.example

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)