jd_oauth.py 907 B

1234567891011121314151617181920212223242526272829303132333435
  1. class Url(object):
  2. CODE = "https://open-oauth.jd.com/oauth2/to_login"
  3. TOKEN = "https://open-oauth.jd.com/oauth2/access_token"
  4. class Params(object):
  5. APP_KEY = "23A1C5CD45F7B2D2EE026E1C72F9CB90"
  6. RESPONSE_CODE = "code"
  7. REDIRECT_URI = "http://develop.5tao5ai.com/testJd"
  8. SCOPE = "snsapi_base"
  9. STATE = "13499"
  10. BID = "100000000006317"
  11. BRANDID = "13499"
  12. STROEID = "24629013"
  13. SKUID = "100001"
  14. def _join_params(self):
  15. return "&".join(
  16. [
  17. "app_key={}".format(self.APP_KEY),
  18. "response_type={}".format(self.RESPONSE_CODE),
  19. "redirect_uri={}".format(self.REDIRECT_URI),
  20. "scope={}".format(self.SCOPE),
  21. "state={}".format(self.STATE),
  22. ]
  23. )
  24. def get_url(self):
  25. return "{}?{}".format(Url.CODE, self._join_params())
  26. print Params().get_url()