-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a279aee
commit 0fcb479
Showing
16 changed files
with
365 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
39 changes: 39 additions & 0 deletions
39
hepsiburadacom/hepsiburadacom/connectors/hepsiburadacom_connection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import frappe | ||
import requests | ||
from requests import HTTPError | ||
from requests.auth import HTTPBasicAuth | ||
|
||
|
||
@frappe.whitelist() | ||
def test_listintegration(username, password, authenticationtype): | ||
servicemethod = 'GET' | ||
serviceurl = "https://listing-external-sit.hepsiburada.com" | ||
serviceendpoint = "/listings/merchantid" | ||
|
||
servicecontenttype = "application/json" | ||
|
||
merchantid = "509778cf-7104-4c7f-850f-e14fdf5beb70" | ||
serviceresource = "/" + merchantid | ||
|
||
servicedata = "" | ||
|
||
req = Request(serviceurl + serviceendpoint + serviceresource, authenticationtype=) | ||
req.add_header("Content-Type", servicecontenttype) | ||
req.method = servicemethod | ||
|
||
# Create an OpenerDirector with support for Basic HTTP Authentication... | ||
auth_handler = HTTPBasicAuthHandler() | ||
auth_handler.add_password(user='framras_dev', | ||
passwd='Fr12345!') | ||
opener = build_opener(auth_handler) | ||
# ...and install it globally so it can be used with urlopen. | ||
install_opener(opener) | ||
|
||
try: | ||
response = urlopen(req) | ||
with response as f: | ||
return f.read().decode('utf-8') | ||
except HTTPError as e: | ||
return 'The server couldn\'t fulfill the request. ' + 'Error code: ' + str(e.code) | ||
except URLError as e: | ||
return 'We failed to reach a server. ' + 'Reason: ' + e.reason |
Empty file.
Empty file.
8 changes: 8 additions & 0 deletions
8
...epsiburadacom_integration_company_settings/hepsiburadacom_integration_company_settings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) 2019, Framras AS-Izmir and contributors | ||
// For license information, please see license.txt | ||
|
||
frappe.ui.form.on('hepsiburadacom Integration Company Settings', { | ||
// refresh: function(frm) { | ||
|
||
// } | ||
}); |
72 changes: 72 additions & 0 deletions
72
...siburadacom_integration_company_settings/hepsiburadacom_integration_company_settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"creation": "2019-11-18 23:40:30.295654", | ||
"doctype": "DocType", | ||
"editable_grid": 1, | ||
"engine": "InnoDB", | ||
"field_order": [ | ||
"company", | ||
"integration_warehouse", | ||
"integration_section", | ||
"username", | ||
"password", | ||
"merchantid" | ||
], | ||
"fields": [ | ||
{ | ||
"fieldname": "company", | ||
"fieldtype": "Link", | ||
"label": "Company", | ||
"options": "Company", | ||
"unique": 1 | ||
}, | ||
{ | ||
"fieldname": "integration_warehouse", | ||
"fieldtype": "Link", | ||
"label": "Integration Warehouse", | ||
"options": "Warehouse" | ||
}, | ||
{ | ||
"fieldname": "integration_section", | ||
"fieldtype": "Section Break", | ||
"label": "Integration Settings" | ||
}, | ||
{ | ||
"fieldname": "username", | ||
"fieldtype": "Data", | ||
"label": "User Name" | ||
}, | ||
{ | ||
"fieldname": "password", | ||
"fieldtype": "Data", | ||
"label": "Password" | ||
}, | ||
{ | ||
"fieldname": "merchantid", | ||
"fieldtype": "Data", | ||
"label": "Merchant ID" | ||
} | ||
], | ||
"modified": "2019-11-18 23:40:30.295654", | ||
"modified_by": "Administrator", | ||
"module": "Hepsiburadacom", | ||
"name": "hepsiburadacom Integration Company Settings", | ||
"owner": "Administrator", | ||
"permissions": [ | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "System Manager", | ||
"share": 1, | ||
"write": 1 | ||
} | ||
], | ||
"quick_entry": 1, | ||
"sort_field": "modified", | ||
"sort_order": "DESC", | ||
"track_changes": 1 | ||
} |
11 changes: 11 additions & 0 deletions
11
...epsiburadacom_integration_company_settings/hepsiburadacom_integration_company_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2019, Framras AS-Izmir and contributors | ||
# For license information, please see license.txt | ||
|
||
from __future__ import unicode_literals | ||
# import frappe | ||
from frappe.model.document import Document | ||
|
||
|
||
class hepsiburadacomIntegrationCompanySettings(Document): | ||
pass |
11 changes: 11 additions & 0 deletions
11
...uradacom_integration_company_settings/test_hepsiburadacom_integration_company_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2019, Framras AS-Izmir and Contributors | ||
# See license.txt | ||
from __future__ import unicode_literals | ||
|
||
# import frappe | ||
import unittest | ||
|
||
|
||
class TesthepsiburadacomIntegrationCompanySettings(unittest.TestCase): | ||
pass |
Empty file.
8 changes: 8 additions & 0 deletions
8
...adacom/doctype/hepsiburadacom_integration_settings/hepsiburadacom_integration_settings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) 2019, Framras AS-Izmir and contributors | ||
// For license information, please see license.txt | ||
|
||
frappe.ui.form.on('hepsiburadacom Integration Settings', { | ||
// refresh: function(frm) { | ||
|
||
// } | ||
}); |
95 changes: 95 additions & 0 deletions
95
...acom/doctype/hepsiburadacom_integration_settings/hepsiburadacom_integration_settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"creation": "2019-11-18 20:34:38.267097", | ||
"doctype": "DocType", | ||
"editable_grid": 1, | ||
"engine": "InnoDB", | ||
"field_order": [ | ||
"contenttype", | ||
"listintegration_section", | ||
"list_host", | ||
"column_break_5", | ||
"list_testhost", | ||
"orderintegration_section", | ||
"order_host", | ||
"column_break_11", | ||
"order_testhost", | ||
"financeintegration_section", | ||
"finance_host" | ||
], | ||
"fields": [ | ||
{ | ||
"fieldname": "contenttype", | ||
"fieldtype": "Data", | ||
"label": "Content Type" | ||
}, | ||
{ | ||
"fieldname": "listintegration_section", | ||
"fieldtype": "Section Break", | ||
"label": "List Integration" | ||
}, | ||
{ | ||
"fieldname": "list_host", | ||
"fieldtype": "Data", | ||
"label": "Host" | ||
}, | ||
{ | ||
"fieldname": "column_break_5", | ||
"fieldtype": "Column Break" | ||
}, | ||
{ | ||
"fieldname": "list_testhost", | ||
"fieldtype": "Data", | ||
"label": "Test Host" | ||
}, | ||
{ | ||
"fieldname": "orderintegration_section", | ||
"fieldtype": "Section Break", | ||
"label": "Order Integration" | ||
}, | ||
{ | ||
"fieldname": "order_host", | ||
"fieldtype": "Data", | ||
"label": "Host" | ||
}, | ||
{ | ||
"fieldname": "column_break_11", | ||
"fieldtype": "Column Break" | ||
}, | ||
{ | ||
"fieldname": "order_testhost", | ||
"fieldtype": "Data", | ||
"label": "Test Host" | ||
}, | ||
{ | ||
"fieldname": "financeintegration_section", | ||
"fieldtype": "Section Break", | ||
"label": "Finance Integration" | ||
}, | ||
{ | ||
"fieldname": "finance_host", | ||
"fieldtype": "Data", | ||
"label": "Host" | ||
} | ||
], | ||
"issingle": 1, | ||
"modified": "2019-11-18 23:35:26.478395", | ||
"modified_by": "Administrator", | ||
"module": "Hepsiburadacom", | ||
"name": "hepsiburadacom Integration Settings", | ||
"owner": "[email protected]", | ||
"permissions": [ | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"print": 1, | ||
"read": 1, | ||
"role": "System Manager", | ||
"share": 1, | ||
"write": 1 | ||
} | ||
], | ||
"sort_field": "modified", | ||
"sort_order": "DESC", | ||
"track_changes": 1 | ||
} |
11 changes: 11 additions & 0 deletions
11
...adacom/doctype/hepsiburadacom_integration_settings/hepsiburadacom_integration_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2019, Framras AS-Izmir and contributors | ||
# For license information, please see license.txt | ||
|
||
from __future__ import unicode_literals | ||
# import frappe | ||
from frappe.model.document import Document | ||
|
||
|
||
class hepsiburadacomIntegrationSettings(Document): | ||
pass |
11 changes: 11 additions & 0 deletions
11
...m/doctype/hepsiburadacom_integration_settings/test_hepsiburadacom_integration_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2019, Framras AS-Izmir and Contributors | ||
# See license.txt | ||
from __future__ import unicode_literals | ||
|
||
# import frappe | ||
import unittest | ||
|
||
|
||
class TesthepsiburadacomIntegrationSettings(unittest.TestCase): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from urllib.request import Request, urlopen, HTTPBasicAuthHandler, build_opener, install_opener | ||
from urllib.error import URLError, HTTPError | ||
import base64 | ||
|
||
servicemethod = 'GET' | ||
serviceprotocol = "https://" | ||
servicehost = "listing-external-sit.hepsiburada.com" | ||
serviceurl = serviceprotocol + servicehost | ||
serviceendpoint = "/listings/merchantid" | ||
|
||
servicecontenttype = "application/json" | ||
|
||
merchantid = "509778cf-7104-4c7f-850f-e14fdf5beb70" | ||
serviceresource = "/" + merchantid | ||
|
||
username = 'framras_dev' | ||
password = 'Fr12345!' | ||
|
||
servicedata = "" | ||
|
||
req = Request(serviceurl + serviceendpoint + serviceresource) | ||
req.add_header("Content-Type", servicecontenttype) | ||
req.add_header("Host", servicehost) | ||
userAndPass = base64.b64encode(username + ":" + password).decode("utf-8") | ||
req.add_header("Authorization", userAndPass) | ||
req.method = servicemethod | ||
|
||
# Create an OpenerDirector with support for Basic HTTP Authentication... | ||
# auth_handler = HTTPBasicAuthHandler() | ||
# auth_handler.add_password(realm=None, | ||
# uri=serviceurl, | ||
# user=username, | ||
# passwd=password) | ||
# opener = build_opener(auth_handler) | ||
# # ...and install it globally so it can be used with urlopen. | ||
# install_opener(opener) | ||
|
||
print(req.headers) | ||
print(req.full_url) | ||
try: | ||
response = urlopen(req) | ||
with response as f: | ||
print(f.read().decode('utf-8')) | ||
except HTTPError as e: | ||
print('The server couldn\'t fulfill the request. ' + 'Error code: ' + str(e.code)) | ||
except URLError as e: | ||
print('We failed to reach a server. ' + 'Reason: ' + e.reason) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import requests | ||
from requests import HTTPError | ||
from requests.auth import HTTPBasicAuth | ||
|
||
servicemethod = 'GET' | ||
serviceprotocol = "https://" | ||
servicehost = "listing-external-sit.hepsiburada.com" | ||
serviceurl = serviceprotocol + servicehost | ||
serviceendpoint = "/listings/merchantid" | ||
|
||
servicecontenttype = "application/json" | ||
|
||
merchantid = "509778cf-7104-4c7f-850f-e14fdf5beb70" | ||
serviceresource = "/" + merchantid | ||
|
||
username = 'framras_dev' | ||
password = 'Fr12345!' | ||
|
||
servicedata = "" | ||
try: | ||
r = requests.get(serviceurl + serviceendpoint + serviceresource, auth=HTTPBasicAuth(username, password)) | ||
with r: | ||
print(r.text) | ||
except HTTPError as e: | ||
print('The server couldn\'t fulfill the request. ' + 'Error code: ' + str(e.code)) | ||
finally: | ||
print(r.request.url) | ||
print(r.request.headers) | ||
|
||
# req = Request() | ||
# req.add_header("Content-Type", servicecontenttype) | ||
# req.add_header("Host", servicehost) | ||
# userAndPass = base64.b64encode(username + ":" + password).decode("utf-8") | ||
# req.add_header("Authorization", userAndPass) | ||
# req.method = servicemethod | ||
|
||
# Create an OpenerDirector with support for Basic HTTP Authentication... | ||
# auth_handler = HTTPBasicAuthHandler() | ||
# auth_handler.add_password(realm=None, | ||
# uri=serviceurl, | ||
# user=username, | ||
# passwd=password) | ||
# opener = build_opener(auth_handler) | ||
# # ...and install it globally so it can be used with urlopen. | ||
# install_opener(opener) | ||
|
||
# print(req.headers) | ||
# print(req.full_url) | ||
|
||
# response = urlopen(req) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
frappe | ||
frappe | ||
requests |