ortexx / getyourbit-python

Getyourbit.com client for python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This library allows you to make requests easily.

Examples

from getyourbit import Api

# create an instance
api = Api("https://ip.getyourbit.com")

# login
api.auth(admin['login'], admin['password'])

# request without scrolling
body = api.request('/me/', {'locale': 'en-US'})
print(body['data'])

# request with scrolling
result = api.scroll('/find/', {
    'size': 500
    'query': {
        'country': 'nepal'
    }
})
print(result)

# logout
api.logout()

Api

.auth(login, password, **kwargs)

Login to the API. You can get login and password on the site after a subscription. You can pass through kwargs any requests module option.
Free services don't require authorization.

.logout()

Logout from the API. It gives an error without authorization before.

.request(url, data={}, **kwargs)

.request(url, **kwargs)

Request to the API without scrolling to get data. It returns all response body as object.

.scroll(url, data={}, callback=None, **kwargs)

.scroll(url, data={}, **kwargs)

.scroll(url, **kwargs)

Request to the API with scrolling to get data. You can pass callback to control every chunk. You will get three arguments:

  • body - chunk response body
  • chunkData - chunk data
  • fullData - full data by the current chunk

It returns the full data at the end

About

Getyourbit.com client for python


Languages

Language:Python 100.0%