closeio / closeio-api

Python API Client for Close
http://developer.close.com/
MIT License
65 stars 47 forks source link

add pkg details to user agent #82

Closed JohnLZeller closed 4 years ago

JohnLZeller commented 7 years ago

In response to https://github.com/closeio/closeio-api/issues/80.

This modifies the default User-Agent to include package details: python closeio v{VERSION} {DEFAULT}

Also breaks out the version constant into its' own version file. This helps to reduce the change of inconsistent versions, while also making it easy to add the seudo-standard __version__ attribute :)

Testing

Setup a simple server script to dump headers when making calls with the client. Then loaded the modified closeio_api and the output of the dump confirms this is working.

----- Request Start ----->

/lead/
Host: localhost:8000
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python closeio v0.5 python-requests/2.11.1
Content-Type: application/json
X-TZ-Offset: -7
Content-Length: 20
Authorization: Basic abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx

{"name": "New Lead"}
<----- Request End -----

127.0.0.1 - - [13/Mar/2017 17:25:57] "POST /lead/ HTTP/1.1" 200 -
philfreo commented 7 years ago

Thanks for the contribution! Did you accidentally forget to include _version.py in this PR?

JohnLZeller commented 7 years ago

I literally just noticed that actually :) You're quick on the draw! (added)

eengoron commented 4 years ago

Closing this via #104