Giter Site home page Giter Site logo

bl_py_wrap's Introduction

NOTE: This is the reference code that was used as a starting point for FluencyMedia/bl_api_wrap

BrightLocal API

A simpler Python wrapper to interface with the BrightLocal REST API. The wrapper abstracts authentication and calls to the standard endpoint.

API Reference

API documentation for BrightLocal: http://apidocs.brightlocal.com/

Examples

# setup api wrappers
api = BrightLocalAPI(key=api_key, secret=api_secret)
batchapi = BrightLocalBatch(api=api)

# Step 1: create a new batch
batch_id = batchapi.create()

assert( batch_id )

print( 'Created batch ID {}'.format(batch_id) )

# Step 2: add directory jobs to batch
for directory in directories:
	result = api.call(
		method='/v4/ld/fetch-profile-url',
		params={
			'batch-id':  batch_id,
			'local-directory': directory,
			'business-names': 'Eleven Madison Park',
			'country': 'USA',
			'city': 'New York',
			'postcode': '10010'
		}
	)
	
	if ( result['success'] ):
		print( 'Added job with ID {}'.format(result['job-id']) );
		pass
	
	pass

# Step 3: Commit batch (to signal all jobs added, processing starts)
success_or_failure = batchapi.commit(batch_id)

if success_or_failure:
	print( 'Committed batch successfully.' )
	pass

Tests

Test methods expect a JSON file named credentials.json with your unique key and secret for using the API.

bl_py_wrap's People

Contributors

pembo13 avatar lairbob avatar

Watchers

 avatar James Cloos avatar Fluency Admin avatar

Forkers

kydubois

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.