Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Official API Connector doesn't work at all #7

Closed
chrism2671 opened this issue Feb 26, 2017 · 4 comments
Closed

Python Official API Connector doesn't work at all #7

chrism2671 opened this issue Feb 26, 2017 · 4 comments

Comments

@chrism2671
Copy link

chrism2671 commented Feb 26, 2017

Swaggerpy is unmaintained and doesn't support Python 3. I believe we should use Bravado (https://github.com/Yelp/bravado), which is a maintained fork.

The URL in the client definition is dead:

bitMEX = SwaggerClient(
    "https://testnet.bitmex.com/api/explorer/resources",
    http_client=http_client)

I've tried my own version (w/ Bravado):
client = SwaggerClient.from_url('https://www.bitmex.com/api/explorer/swagger.json')
but this fails Swagger spec validation.

It does seem to load the resources correctly though if I force it:

client = SwaggerClient.from_url('https://www.bitmex.com/api/explorer/swagger.json',
                                config={'validate_swagger_spec': False)

I still get errors though when I try to make requests, even if I turn off all (other) validations (as per Bravado docs).

client = SwaggerClient.from_url('https://www.bitmex.com/api/explorer/swagger.json',
                                config={'validate_swagger_spec': False, 'validate_responses':False, 'also_return_response':True, 'use_models': False})

client.Quote.Quote_get(symbol='XBTH17').result()

Is there any chance we can get an up-to-date example of this working with Python?

@STRML
Copy link
Contributor

STRML commented Feb 26, 2017

Thanks for the notice; Swagger compliance is remarkably complicated due to some ambiguity in the spec and typical human error.

I'll release an update but we may have to fork bravado-core due to Yelp/bravado-core#46. I'll see about getting our spec updated to eliminate some of the errors.

@STRML STRML closed this as completed in b111d24 Feb 26, 2017
@STRML
Copy link
Contributor

STRML commented Feb 26, 2017

@chrism2671 This is now working on testnet; I've applied some small changes to our Swagger JSON output to keep the validators happy.

We'll roll the changes to production within the next day; in the meantime please use Testnet.

@chrism2671
Copy link
Author

@STRML This is amazing! Thank you so much! I'm gonna get stuck in today; I'll report back if I have any problems!

@STRML
Copy link
Contributor

STRML commented Feb 27, 2017

Glad to hear. This change has rolled out to all environments so feel free to grab data from www. as well, it should work without issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants