Title: GitHub · Where software is built
Open Graph Title: lockwooddev/python-wowapi
X Title: lockwooddev/python-wowapi
Description: A client library for interacting with the World of Warcraft Community, Game Data and Profile API's - lockwooddev/python-wowapi
Open Graph Description: A client library for interacting with the World of Warcraft Community, Game Data and Profile API's - lockwooddev/python-wowapi
X Description: A client library for interacting with the World of Warcraft Community, Game Data and Profile API's - lockwooddev/python-wowapi
Opengraph URL: https://github.com/lockwooddev/python-wowapi
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug in the `_get_client_credentials` function when getting other-region data.","articleBody":"Hi, I've noticed a small bug.\r\n\r\n**api.py: _get_client_credentials(self, region):**\r\n\r\n```python\r\n def _get_client_credentials(self, region):\r\n path = '/oauth/token'\r\n data = {'grant_type': 'client_credentials'}\r\n auth = HTTPBasicAuth(self._client_id, self._client_secret)\r\n\r\n #url = 'https://{0}.battle.net{1}'.format(region, path)\r\n url = 'https://eu.battle.net{1}'.format(region, path)\r\n```\r\n\r\nAs you can see, I intentionally commented out the \"region.battle.net\" code and replaced it with \"eu.battle.net\". Why?\r\n\r\nBecause:\r\n\r\n```python\r\n# Code:\r\ndata = api.get_spell(\"tw\", namespace=\"static-tw\", id=195072, locale='zh_TW')\r\n# Result:\r\n# 2021-07-05 15:24:50,980 - wowapi - WARNING - Invalid response - 401 for https://tw.battle.net/oauth/token\r\n```\r\n\r\nCode 401 means \"Unauthorized\". I am not authorized to login to tw.battle.net.\r\n\r\nChanging it to login to your own account's region and THEN querying the other regions is the correct way to use the API. And yes, to query data from another region you do need to provide a region to the wowapi.get_spell() etc APIs.\r\n\r\nSo the oauth login must be your region. The query must be the target region.\r\n\r\nFurthermore, their documentation pages say that the data is segmented into region locks. Non-Chinese accounts can query all regions except China. Chinese accounts can only query Chinese regions (zh_CN):\r\n\r\n- Described here: https://develop.battle.net/documentation/guides/regionality-and-apis\r\n- List of locales etc: https://develop.battle.net/documentation/world-of-warcraft/guides/localization","author":{"url":"https://github.com/Arcitec","@type":"Person","name":"Arcitec"},"datePublished":"2021-07-05T13:31:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/26/python-wowapi/issues/26"}
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:16187e22-bce1-2949-3f8e-f587870fbae8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F04:9D4B7:197089:215DE4:698FBA8C |
| html-safe-nonce | ae175e6b6d5fa5cfff26f683d51cd337b975df282c07540103a32b270946eec7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjA0OjlENEI3OjE5NzA4OToyMTVERTQ6Njk4RkJBOEMiLCJ2aXNpdG9yX2lkIjoiMzI4NTE0MzY3OTU4MTI3MjcxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 02c81d3d5d32915a286cea9e98ab5a3828431c99646829e48381ec3b4b650bf3 |
| hovercard-subject-tag | repository:10436770 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/lockwooddev/python-wowapi/issues/26 |
| twitter:image | https://opengraph.githubassets.com/7bc7e2368afe08809684b920e7e2b2a507c77590430a57c67d3a8ff2510302ed/lockwooddev/python-wowapi |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7bc7e2368afe08809684b920e7e2b2a507c77590430a57c67d3a8ff2510302ed/lockwooddev/python-wowapi |
| og:image:alt | A client library for interacting with the World of Warcraft Community, Game Data and Profile API's - lockwooddev/python-wowapi |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-cache |
| go-import | github.com/lockwooddev/python-wowapi git https://github.com/lockwooddev/python-wowapi.git |
| octolytics-dimension-user_id | 867686 |
| octolytics-dimension-user_login | lockwooddev |
| octolytics-dimension-repository_id | 10436770 |
| octolytics-dimension-repository_nwo | lockwooddev/python-wowapi |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 10436770 |
| octolytics-dimension-repository_network_root_nwo | lockwooddev/python-wowapi |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4084c47bba08e7ba5fab63cb1dd485a339910ed7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width