api_entreprise: enforces PEP8 (#33056)
This commit is contained in:
parent
d18fa62ba6
commit
a2eccafe01
|
@ -120,9 +120,8 @@ class APIEntreprise(BaseResource):
|
|||
'data': data,
|
||||
}
|
||||
|
||||
|
||||
@endpoint(perm='can_access',
|
||||
pattern='(?P<association_id>\w+)/$',
|
||||
pattern=r'(?P<association_id>\w+)/$',
|
||||
example_pattern='{association_id}/',
|
||||
description=_('Get association\'s documents'),
|
||||
parameters={
|
||||
|
@ -142,8 +141,7 @@ class APIEntreprise(BaseResource):
|
|||
'description': _('request recipient: usually customer number'),
|
||||
'example_value': '44317013900036'
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
def documents_associations(self, request, association_id, **kwargs):
|
||||
data = []
|
||||
resp = self.get('documents_associations/%s/' % association_id, **kwargs)
|
||||
|
@ -156,10 +154,14 @@ class APIEntreprise(BaseResource):
|
|||
'object': kwargs['object'],
|
||||
'recipient': kwargs['recipient']}
|
||||
signature = signing.dumps(signature_elements)
|
||||
document_url = request.build_absolute_uri(reverse('generic-endpoint', kwargs={'connector': self.get_connector_slug(),
|
||||
'slug': self.slug,
|
||||
'endpoint': 'document',
|
||||
'rest': '%s/%s/' % (association_id, signature)}))
|
||||
document_url = request.build_absolute_uri(
|
||||
reverse('generic-endpoint',
|
||||
kwargs={
|
||||
'connector': self.get_connector_slug(),
|
||||
'slug': self.slug,
|
||||
'endpoint': 'document',
|
||||
'rest': '%s/%s/' % (association_id, signature),
|
||||
}))
|
||||
item['id'] = item['timestamp']
|
||||
item['text'] = item['type']
|
||||
item['url'] = document_url
|
||||
|
@ -168,8 +170,7 @@ class APIEntreprise(BaseResource):
|
|||
data.sort(key=lambda i: i['id'])
|
||||
return {'err': 0, 'data': data}
|
||||
|
||||
|
||||
@endpoint(pattern='(?P<association_id>\w+)/(?P<document_id>[\:\w-]+)/$',
|
||||
@endpoint(pattern=r'(?P<association_id>\w+)/(?P<document_id>[\:\w-]+)/$',
|
||||
example_pattern='{association_id}/{document_id}/',
|
||||
description=_('Get association\'s document'),
|
||||
parameters={
|
||||
|
@ -193,8 +194,7 @@ class APIEntreprise(BaseResource):
|
|||
'description': _('request recipient: usually customer number'),
|
||||
'example_value': '44317013900036'
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
def document(self, request, association_id, document_id, **kwargs):
|
||||
try:
|
||||
params = signing.loads(document_id, max_age=DOCUMENT_SIGNATURE_MAX_AGE)
|
||||
|
@ -205,9 +205,8 @@ class APIEntreprise(BaseResource):
|
|||
return HttpResponse(response, content_type='application/pdf')
|
||||
raise Http404('document not found')
|
||||
|
||||
|
||||
@endpoint(perm='can_access',
|
||||
pattern='(?P<siren>\w+)/$',
|
||||
pattern=r'(?P<siren>\w+)/$',
|
||||
example_pattern='{siren}/',
|
||||
description=_('Get firm\'s data from Infogreffe'),
|
||||
parameters={
|
||||
|
@ -227,14 +226,12 @@ class APIEntreprise(BaseResource):
|
|||
'description': _('request recipient: usually customer number'),
|
||||
'example_value': '44317013900036'
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
def extraits_rcs(self, request, siren, **kwargs):
|
||||
return self.get('extraits_rcs_infogreffe/%s/' % siren, **kwargs)
|
||||
|
||||
|
||||
@endpoint(perm='can_access',
|
||||
pattern='(?P<association_id>\w+)/$',
|
||||
pattern=r'(?P<association_id>\w+)/$',
|
||||
example_pattern='{association_id}/',
|
||||
description=_('Get association\'s related informations'),
|
||||
parameters={
|
||||
|
@ -254,14 +251,12 @@ class APIEntreprise(BaseResource):
|
|||
'description': _('request recipient: usually customer number'),
|
||||
'example_value': '44317013900036'
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
def associations(self, request, association_id, **kwargs):
|
||||
return self.get('associations/%s/' % association_id, **kwargs)
|
||||
|
||||
|
||||
@endpoint(perm='can_access',
|
||||
pattern='(?P<siren>\w+)/$',
|
||||
pattern=r'(?P<siren>\w+)/$',
|
||||
example_pattern='{siren}/',
|
||||
description=_('Get firm\'s related informations'),
|
||||
parameters={
|
||||
|
@ -281,15 +276,13 @@ class APIEntreprise(BaseResource):
|
|||
'description': _('request recipient: usually customer number'),
|
||||
'example_value': '44317013900036'
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
def entreprises(self, request, siren, **kwargs):
|
||||
return self.get('entreprises/%s/' % siren, **kwargs)
|
||||
|
||||
|
||||
@endpoint(perm='can_access',
|
||||
methods=['get'],
|
||||
pattern='(?P<siret>\w+)/$',
|
||||
pattern=r'(?P<siret>\w+)/$',
|
||||
example_pattern='{siret}/',
|
||||
description_get=_('Get firms\'s related informations'),
|
||||
parameters={
|
||||
|
@ -309,7 +302,6 @@ class APIEntreprise(BaseResource):
|
|||
'description': _('request recipient: usually customer number'),
|
||||
'example_value': '44317013900036'
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
def etablissements(self, request, siret, **kwargs):
|
||||
return self.get('etablissements/%s/' % siret, **kwargs)
|
||||
|
|
Loading…
Reference in New Issue