Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2279f37

Browse files
First working public version
1 parent 149a1d4 commit 2279f37

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ Following is an abridged example, here is the [full working code](https://github
5353
import os
5454
import json
5555
import python_http_client
56-
Config()
56+
path_to_env = os.path.abspath(os.path.dirname(__file__))
57+
python_http_client.Config(path_to_env)
5758
host = os.environ.get('HOST')
5859
api_key = os.environ.get('SENDGRID_API_KEY')
5960
request_headers = {'Authorization': 'Bearer ' + api_key, 'Content-Type': 'application/json'}
6061
version = 3 # note that we could also do client.version(3) to set the version for each endpoint
61-
client = Client(host=host,
62-
request_headers=request_headers,
63-
version=version)
62+
client = python_http_client.Client(host=host,
63+
request_headers=request_headers,
64+
version=version)
6465

6566
# GET collection
6667
response = client.api_keys.get()

examples/live_sendgrid_example.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import os
22
import json
33
import python_http_client
4-
Config()
4+
python_http_client.Config(os.path.abspath(os.path.dirname(__file__)))
55
host = os.environ.get('HOST')
66
api_key = os.environ.get('SENDGRID_API_KEY')
77
request_headers = {
88
'Authorization': 'Bearer ' + api_key,
99
'Content-Type': 'application/json'
1010
}
1111
version = 3 # we could also use client.version(3)
12-
client = Client(host=host,
13-
request_headers=request_headers,
14-
version=version)
12+
client = python_http_client.Client(host=host,
13+
request_headers=request_headers,
14+
version=version)
1515

1616
# GET collection
1717
response = client.api_keys.get()

python_http_client/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
class Config(object):
55
"""Allow variables assigned in .env available using
6-
os.environ.get('VAR_NAME')"""
6+
os.environ.get('VAR_NAME')
7+
8+
:param base_path: The path to your .env config file
9+
:type base_path: string
10+
"""
711
def __init__(self, base_path=None):
812
if base_path == "test":
913
base_path = os.path.join(os.path.dirname(__file__), os.pardir)

0 commit comments

Comments
 (0)