Commit graph

70 commits

Author SHA1 Message Date
Deepesh Garg
cf164fffba fix: Error on updating docs via API 2021-07-13 19:11:07 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Gavin D'souza
b215921a97 fix: Convert only as_dict and debug values to bool
Given the scope of its usage at this point, this becomes a problem when you'd have a field named y,n, true, false and order_by that field, or have the same values for a document name that parent parameter would accept out of all those that Frappe REST allows.
2021-05-25 21:44:54 +05:30
Gavin D'souza
724a5b2536 fix: Evaluate boolean values better via /api/resource/<doctype>
`GET /api/resource/ToDo?limit=10&debug=False&as_dict=0` would be received by the resource handler as debug="False" and as_dict="0" which are both truthy values.

So, even though you requested for a list of lists response without debugging on, you'd get the exact opposite; debug on and a list of dicts.

- Evaluate boolean values for `GET /api/resource/<doctype>`
- Added `limit` parameter as an alias for `limit_page_length`
- Added `frappe.utils.data.sbool` that converts strings to bool values if applicable.
- Added some seemingly stupid comments for the sake of consistency.
2021-04-30 21:18:38 +05:30
Suraj Shetty
190cf2785b
Merge branch 'develop' into oauth-multipart-form 2021-04-25 10:57:31 +05:30
Fahim Ali Zain
0a0967e35a fix: multipart/form-data breaks with OAuth tokens 2021-04-24 15:53:09 +05:30
Revant Nandgaonkar
1d0e72834d fix: remove unused imports 2021-04-19 15:54:16 +05:30
Revant Nandgaonkar
8c74df6cc3 fix: duplicate validate_auth calls 2021-04-19 15:18:15 +05:30
Rohan Bansal
557235471e fix: remove unused variables 2021-04-19 13:44:18 +05:30
Revant Nandgaonkar
d309343c6f feat(hooks): auth hooks
hook for request authentication
2021-04-19 06:31:28 +05:30
Kevin Wiesmüller
9b9f067db1
fix: API login inconsistency (#10427)
* do not overwrite user if it's already set

* Update frappe/api.py

* chore: fix syntax error and translation syntax

Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2020-06-24 04:22:30 +00:00
prafful1234
e19b712e23
fix(api): Fix api for user oauth validations (#9676)
* fix(api): Fix api for user oauth validations

* fix: add auth exceptions + format functions

* fix: Moved exceptions and a validation check

* Fix: Reqested changes

Co-authored-by: prafful1234 <prafful@mntechnique.com>
Co-authored-by: Rohan Bansal <rohan@digithinkit.com>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2020-04-11 10:27:00 +05:30
Suraj Shetty
47a19ce6e5
fix(api): Parse data as json only if data is string (#9791)
* fix: Json load data only if data is string

* refactor: Simplify code
2020-03-27 22:54:56 +05:30
mergify[bot]
f11b8fc476
Merge pull request #8567 from ruchamahabal/offline-erpnext
feat: Events Streaming
2020-01-27 11:58:15 +00:00
Rucha Mahabal
8147fa45dd fix: anti-pattern code 2020-01-27 14:07:13 +05:30
Rucha Mahabal
19c69e5316 fix: anti-pattern code 2020-01-27 12:26:12 +05:30
Rohan Bansal
334bb2fe7a fix: save parent document if child document is updated 2020-01-22 16:20:31 +05:30
Rucha Mahabal
24a75f74b7 fix: improve logic 2019-12-26 11:37:12 +05:30
Rucha Mahabal
199291e9c5 fix: conflicts 2019-12-09 17:16:18 +05:30
Ben Knowles
a8914a2cbd fix: REST API utf-8 decoding on creates/updates (#8875)
* fix: REST API utf-8 decoding on creates/updates

Creating or updating a document via the REST API would generate an error of:

`TypeError: the JSON object must be str, not 'bytes'`

Because get_data() returns bytes which must be explicitly converted to a string before parsing as JSON.

Defect introduced by efe94886a and a71a92341e

* fix: switch to safe_decode
2019-12-03 06:44:11 +00:00
Rucha Mahabal
fa6a29ff37 fix: conflicts 2019-11-13 11:23:30 +05:30
makeen
efe94886a8
Update api.py 2019-11-01 00:53:29 +01:00
Rucha Mahabal
ea55c09158 fix: save last update as timestamp instead of docname 2019-10-31 12:00:59 +05:30
Rucha Mahabal
a3094fcd7d fix: populating child table with fields in doctype mapping 2019-10-24 12:53:26 +05:30
Rucha Mahabal
6a4c041045 fix: tests 2019-10-11 02:16:32 +05:30
Rucha Mahabal
ee2e1936d3 fix: event consumer authentication 2019-10-11 02:16:31 +05:30
Rucha Mahabal
b015b7e797 fix: api 2019-10-11 02:16:31 +05:30
Rucha Mahabal
3f415094e9 feat: token based auth in frappeclient 2019-10-11 02:16:31 +05:30
Faris Ansari
53fce6c2f2 fix: Undefined request variable 2019-08-23 14:14:56 +05:30
Raffael Meyer
a71a92341e
fix(API): allow creation from request data
Counteract f63ad574e5
Fix #8230
2019-08-22 00:14:38 +02:00
Sahil Khan
7d03c97c75 feat(translator_portal): change url to translator app 2019-06-27 18:07:27 +05:30
Sahil Khan
77856742ff feat(translator_portal): use frappe's post_request method 2019-06-27 18:07:27 +05:30
Sahil Khan
bc6696ad23 feat(translator_portal): contribute translations 2019-06-27 18:07:27 +05:30
Shivam Mishra
77abf5fc19
Revert "fix(request): Pop data from form_dict when it isn't needed" 2019-03-14 11:58:46 +05:30
Aditya Hase
55220a0eab fix(request): Pop data from form_dict when it isn't needed 2019-03-13 19:51:15 +05:30
Shridhar Patil
abd3333bae Token based authentication (#5752)
* token based authentication

* authentication

Basic base64encode(api_key:api_secret)
token api_key:api_secret

* test added

Validation: only user with system manager can generate the keys

* codacy issues fixed

* token based authentication

* authentication

Basic base64encode(api_key:api_secret)
token api_key:api_secret

* test added

Validation: only user with system manager can generate the keys

* codacy issues fixed

* use frappe.safe_encode

* base64 encode use frappe.safe_encode

* set frappe.local.form_dict after setting user

* removed test

* removed unused imports

* test for python 3

* Update user.js

* [user.py] throw correct error

* Update user.py
2018-07-23 11:06:29 +05:30
Makarand Bauskar
6fa9967a04 [hotfix] throw DoesNotExistError if doctype is not available on Delete api (#4013)
* [hotfix] throw DoesNotExistError if doctype is not available on Delete api

* [fixes] aded tests cases and codecy, travis fixes
2017-09-01 09:16:32 +05:30
Aditya Hase
e324406c8a Import six.moves.urllib.parse.urlencode instead of urllib.urlencode 2017-08-11 00:38:26 +05:30
Aditya Hase
375dfd601d Replaced urlparse imports with six.moves.urllib.parse (#3847) 2017-08-03 11:43:28 +05:30
Saurabh
7620bb3789 Deprecate Integration Broker (#2831)
* [fix] remove razorpay from integration service

* [fix] clean-up js side integration service dependancies

* [fix] remove integration service, .py cleanup, move integration request to integration

* [fix] move oauth to integrations and deprecate integration broker

* [fix] mark services enabled and update integrations listing

* [fix] V7.1 and V7.2 integration service related pathch fixes and move payment gateway dotype to core module

* [fix] create payment gateway records if not exists

* [fix] module page for integrations

* [minor][fix] minor checks

* [fix] remove integration broker module only if not allocated to any doctype
2017-03-14 11:24:26 +05:30
Revant Nandgaonkar
7757aaef6a [Fix] oauth url delimiter moved to function instead of global (#2305)
* [Fix] oauth url delimiter moved to function instead of global

* [Fix] renamed oauth_url_delimiter to get_url_delimiter
2016-11-14 12:05:47 +05:30
Rushabh Mehta
924510610b [fix] remove global variables in oauth 2016-11-11 14:57:13 +05:30
Rushabh Mehta
80a3a3f8f1 [fix] global variable import issue 2016-11-11 14:50:12 +05:30
Revant Nandgaonkar
d48b270bf5 OAuth 2 Provider for frappe (#2167)
* OAuth 2.0 Classes Added

Added oauthlib in requirement.txt
Added class WebApplicationServer for Authorization code grant and Bearer tokens.
Added class OAuthWebRequestValidator for Validating Oauth Request for Web Application

* copied code from mnt_oauth needs review

* [New] OAuth2 Doctypes and endpoints added

Integrations > OAuth Provider Settings
Integration Broker > OAuth Bearer Token
Integration Broker > OAuth Authorization Code
Integration Broker > OAuth Client
endpoints for authorize, approve, get_token, revoke_token and test_resource

* oauth2.py: renamed skipauth to skip_auth

* [Fix] Parse URL instead of storing it in settings

* [Fix] get skip_auth from OAuth Provider Settings

* Success URL format. Failure URL added. Confirmation dialog layout changed.

* Validate access token if passed during use of REST API

* OAuth Confirmation colours fixed

* Multiple Changes

Added links for OAuth under Integrations in Module list.
Updated permissions on OAuth doctypes.
Updated layout of OAuth Client doctype.

* [Docs] Integrations > How to setup OAuth

* [Docs] Integration > Using OAuth

* [Fix] get_token endpoint must to handle POST request

* [Fix] http verbs and responses for OAuth 2.0 Endpoints

* [Fix] accept oauth2 access_token from headers

* Removed unused imports from api.py
2016-10-25 10:28:32 +05:30
Rushabh Mehta
74919b99a0 [enhancement] remember list settings - sort, filters, paging 2016-05-30 18:19:47 +05:30
Pratik Vyas
422668a67f Async 2015-07-24 10:07:24 +05:30
Anand Doshi
98958334b5 Merge pull request #1026 from pdvyas/limit-page-length
limit page length to 20 by default only for api requests
2015-03-03 15:45:49 +05:30
Anand Doshi
2995f02f3b Web Notes to Frappe, better alerts, css fixes, fixed splash 2015-03-03 15:09:34 +05:30
Anand Doshi
f6cdd4a655 Merge remote-tracking branch 'frappe/develop' into v5.0
Conflicts:
	frappe/__version__.py
	frappe/core/doctype/communication/communication.py
	frappe/core/page/desktop/desktop.js
	frappe/hooks.py
	frappe/translations/ar.csv
	frappe/translations/es.csv
	frappe/translations/fr.csv
	frappe/translations/hr.csv
	frappe/translations/id.csv
	frappe/translations/ja.csv
	frappe/translations/nl.csv
	frappe/translations/pl.csv
	frappe/translations/pt-BR.csv
	frappe/translations/ru.csv
	frappe/translations/tr.csv
	frappe/translations/zh-cn.csv
	frappe/translations/zh-tw.csv
	frappe/utils/email_lib/html2text.py
	setup.py
2015-02-24 18:06:16 +05:30
Anand Doshi
f3b37df2dd [fix] Added unicode_literals if missing in py files 2015-02-24 12:24:20 +05:30