Table Of Contents

Previous topic

Getting started

Next topic

Reference Documentation: Classes and Methods

This Page

How to

Note

Every method is fully documented in the docstring, so you can refer to the Reference Documentation: Classes and Methods or directly view help in the interactive console.

To get help on the method use:

help(client.provider.search_jobs)

or if you use IPython just add ? symbol at the end of an object/class/method:

client.provider.search_jobs?

Authenticate

https://developers.odesk.com/?lang=python#authentication

To authenticate your web application with the python-odesk, use something similar to the code below:

public_key = raw_input('Please enter public key: > ')
secret_key = raw_input('Please enter secret key: > ')

#Instantiating a client without an auth token
client = odesk.Client(public_key, secret_key)

print "Please to this URL (authorize the app if necessary):"
print client.auth.get_authorize_url()
print "After that you should be redirected back to your app URL with " + \
      "additional ?oauth_verifier= parameter"

verifier = raw_input('Enter oauth_verifier: ')

oauth_access_token, oauth_access_token_secret = \
    client.auth.get_access_token(verifier)

# Instantiating a new client, now with a token.
# Not strictly necessary here (could just set `client.oauth_access_token`
# and `client.oauth_access_token_secret`), but typical for web apps,
# which wouldn't probably keep client instances between requests
client = odesk.Client(public_key, secret_key,
                      oauth_access_token=oauth_access_token,
                      oauth_access_token_secret=oauth_access_token_secret)

Freelancer’s information

https://developers.odesk.com/?lang=python#public-profiles_get-brief-profile-summary https://developers.odesk.com/?lang=python#public-profiles_get-profile-details

To get information about freelancer, use following methods (click the link to see detailed description of parameters):

client.provider.get_provider

client.provider.get_provider_brief

Metadata information

To get information about available categories, skills, regions and tests use:

client.provider.get_categories_metadata

client.provider.get_skills_metadata

client.provider.get_regions_metadata

client.provider.get_tests_metadata

Hiring

oDesk Hiring API https://developers.odesk.com/?lang=python#contracts-and-offers allows to do such tasks as:

Work with jobs

https://developers.odesk.com/?lang=python#jobs_get-job-profile

To work with jobs you should use client.job wrapper:

tasks = client.job.get_job_profile(job key)

Where:

  • job_key - The job key or a list of keys, separated by ";", number of keys per request is limited by 20. You can access profile by job reference number, in that case you can’t specify a list of jobs, only one profile per request is available.

Team’s information

https://developers.odesk.com/?lang=python#companies-and-teams

After authentication, you can get teams’ information from client instance you have:

client.team_v2.get_teamrooms

To get snapshots:

client.team_v2.get_snapshots

To get user’s workdiaries inside the team:

client.team.get_workdiaries

Trays and messages

https://developers.odesk.com/?lang=python#messages

Get user’s trays (if user not provided, authenticated user will be taken):

client.mc.get_trays

Get content of the tray:

client.mc.get_tray_content

Get content of the thread:

client.mc.get_thread_content

Get timereports

https://developers.odesk.com/?lang=python#reports_time-reports-fields

To get timereports, use, based on the level of the timereports you need:

client.timereport.get_provider_report

timereport.get_company_report

timereport.get_agency_report

Below is an example how to construct a GDS query:

client.timereport.get_provider_report('user1',
       odesk.utils.Query(select=odesk.utils.Query.DEFAULT_TIMEREPORT_FIELDS,
                    where=(odesk.utils.Q('worked_on') <= date.today()) &\
                            (odesk.utils.Q('worked_on') > '2010-05-01')))


client.timereport.get_provider_report('user1',
       odesk.utils.Query(select=odesk.utils.Query.DEFAULT_TIMEREPORT_FIELDS,
                    where=(odesk.utils.Q('worked_on') <= date.today()) &\
                            (odesk.utils.Q('worked_on') > '2010-05-01')), hours=True)

client.timereport.get_agency_report('company1', 'agency1',
       odesk.utils.Query(select=odesk.utils.Query.DEFAULT_TIMEREPORT_FIELDS,
                    where=(odesk.utils.Q('worked_on') <= date.today()) &\
                            (odesk.utils.Q('worked_on') > '2010-05-01')), hours=True)

Get finreports

https://developers.odesk.com/?lang=python#reports_financial-reports-fields

Financial reports are also using GDS queries.

Please see Finreports wrapper

Work with Activities

https://developers.odesk.com/?lang=python#activities

To work with Activities you should use client.task wrapper:

tasks = client.task.get_team_tasks('your_company_id', 'your_team_id')

Note, that company_id here is basically a parent_team__id value from the hr.get_team() API call.

Methods to get activities:

client.task.get_team_tasks

client.task.get_company_tasks

client.task.get_team_specific_tasks

client.task.get_company_specific_tasks

Create and update activities:

client.task.post_team_task

client.task.post_company_task

client.task.put_team_task

client.task.put_company_task

Archive/unarchive activities:

client.task.archive_team_task

client.task.archive_company_task

client.task.unarchive_team_task

client.task.unarchive_company_task

Assign activities to the contractor’s engagement:

client.task.assign_engagement