-
Notifications
You must be signed in to change notification settings - Fork 44
/
create_employer_review.py
39 lines (33 loc) · 1.06 KB
/
create_employer_review.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from freelancersdk.session import Session
from freelancersdk.resources.projects.projects import post_review
from freelancersdk.resources.projects.helpers import \
create_review_employer_object
from freelancersdk.resources.projects.exceptions import \
ReviewNotPostedException
import os
def sample_post_review():
url = os.environ.get('FLN_URL')
oauth_token = os.environ.get('FLN_OAUTH_TOKEN')
session = Session(oauth_token=oauth_token, url=url)
review = create_review_employer_object(
project_id=201,
employer_id=101,
freelancer_id=102,
clarity_spec=5,
communication=5,
payment_prom=5,
professionalism=5,
work_for_again=5,
comment='Thanks for all the fish'
)
try:
r = post_review(session, review)
except ReviewNotPostedException as e:
print('Error message: {}'.format(e.message))
print('Server response: {}'.format(e.error_code))
return None
else:
return r
r = sample_post_review()
if r:
print('Review created: {}'.format(r))